GEOSX
|
This class provides an interface similar to an std::set. More...
#include <SortedArray.hpp>
Public Types | |
using | ParentClass = SortedArrayView< T, INDEX_TYPE, BUFFER_TYPE > |
Alias for the parent class. | |
using | ViewType = SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > const |
The view type. | |
using | ViewTypeConst = SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > const |
The const view type. More... | |
using | ValueType = T |
The type of the values contained in the SortedArrayView. | |
using | IndexType = INDEX_TYPE |
The integer type used for indexing. | |
using | value_type = T |
The type of the values contained in the SortedArrayView, here for stl compatability. | |
using | size_type = INDEX_TYPE |
The integer type used for indexing, here for stl compatability. | |
Public Member Functions | |
void | setName (std::string const &name) |
Set the name to be displayed whenever the underlying Buffer's user call back is called. More... | |
Constructors, destructor and assignment operators. | |
SortedArray () | |
Default constructor. | |
SortedArray (SortedArray const &src) | |
The copy constructor, performs a deep copy. More... | |
SortedArray (SortedArray &&src)=default | |
Default move constructor, performs a shallow copy. More... | |
~SortedArray () | |
Destructor, frees the values array. | |
SortedArray & | operator= (SortedArray const &src) |
Copy assignment operator, performs a deep copy. More... | |
SortedArray & | operator= (SortedArray &&src) |
Default move assignment operator, performs a shallow copy. More... | |
SortedArrayView creation methods | |
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toView () const & |
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toView () const &&=delete |
Overload for rvalues that is deleted. More... | |
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toViewConst () const & |
SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toViewConst () const &&=delete |
Overload for rvalues that is deleted. More... | |
Attribute querying methods | |
constexpr INDEX_TYPE | size () const |
Methods that provide access to the data. | |
constexpr T const * | data () const |
Methods to insert or remove values | |
bool | insert (T const &value) |
Insert the given value into the array if it doesn't already exist. More... | |
template<typename ITER > | |
INDEX_TYPE | insert (ITER const first, ITER const last) |
Insert the values in [ first , last ) into the array if they don't already exist. More... | |
bool | remove (T const &value) |
Remove the given value from the array if it exists. More... | |
template<typename ITER > | |
INDEX_TYPE | remove (ITER const first, ITER const last) |
Remove the values in [ first , last ) from the array if they exist. More... | |
Methods that modify the size or capacity | |
void | clear () |
Remove all the values from the array. | |
void | reserve (INDEX_TYPE const nVals) |
Reserve space to store the given number of values without resizing. More... | |
Methods dealing with memory spaces | |
void | move (MemorySpace const space, bool const touch=true) const |
Moves the SortedArrayView to the given execution space. More... | |
Additional Inherited Members | |
Protected Types inherited from LvArray::SortedArrayView< T, INDEX_TYPE, BUFFER_TYPE > | |
using | ValueType = T |
The type of the values contained in the SortedArrayView. | |
using | IndexType = INDEX_TYPE |
The integer type used for indexing. | |
using | value_type = T |
The type of the values contained in the SortedArrayView, here for stl compatability. | |
using | size_type = INDEX_TYPE |
The integer type used for indexing, here for stl compatability. | |
Protected Member Functions inherited from LvArray::SortedArrayView< T, INDEX_TYPE, BUFFER_TYPE > | |
SortedArrayView () | |
Default constructor. More... | |
SortedArrayView (SortedArrayView const &src)=default | |
Default copy constructor. Performs a shallow copy and calls the chai::ManagedArray copy constructor. More... | |
constexpr | SortedArrayView (SortedArrayView &&src) |
Default move constructor, performs a shallow copy. More... | |
constexpr | SortedArrayView (INDEX_TYPE const size, BUFFER_TYPE< T > const &buffer) |
Construct a new SortedArrayView from the given buffer. More... | |
SortedArrayView & | operator= (SortedArrayView const &src)=default |
Default copy assignment operator, this does a shallow copy. More... | |
constexpr SortedArrayView & | operator= (SortedArrayView &&src) |
Default move assignment operator, this does a shallow copy. More... | |
constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toView () const |
constexpr SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > | toViewConst () const |
constexpr ArraySlice< T const, 1, 0, INDEX_TYPE > | toSlice () const & |
constexpr ArraySlice< T const, 1, 0, INDEX_TYPE > | toSlice () const &&=delete |
Overload for rvalues that is deleted. More... | |
constexpr bool | empty () const |
constexpr INDEX_TYPE | size () const |
bool | contains (T const &value) const |
bool | count (T const &value) const |
constexpr T const & | operator[] (INDEX_TYPE const i) const |
constexpr T const & | operator() (INDEX_TYPE const i) const |
constexpr T const * | data () const |
constexpr T const * | begin () const |
constexpr T const * | end () const |
void | move (MemorySpace const space, bool touch=true) const |
Moves the SortedArrayView to the given execution space. More... | |
Protected Attributes inherited from LvArray::SortedArrayView< T, INDEX_TYPE, BUFFER_TYPE > | |
BUFFER_TYPE< T > | m_values |
Holds the array of values. | |
INDEX_TYPE | m_size = 0 |
The number of values. | |
This class provides an interface similar to an std::set.
T | type of data that is contained by the array. |
INDEX_TYPE | the integer to use for indexing the components of the array. |
The difference between this class and std::set is that the values are stored contiguously in memory. It maintains O(log(N)) lookup time but insertion and removal are O(N).
The derivation from SortedArrayView is protected to control the conversion to SortedArrayView. Specifically only conversion to SortedArrayView<T const> is allowed.
Definition at line 35 of file SortedArray.hpp.
using LvArray::SortedArray< T, INDEX_TYPE, BUFFER_TYPE >::ViewTypeConst = SortedArrayView< T const, INDEX_TYPE, BUFFER_TYPE > const |
The const view type.
Definition at line 55 of file SortedArray.hpp.
|
inline |
The copy constructor, performs a deep copy.
src | The SortedArray to copy. |
Definition at line 77 of file SortedArray.hpp.
|
inlinedefault |
Default move constructor, performs a shallow copy.
src | the SortedArray to be moved from. |
|
inline |
using
statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC. Definition at line 209 of file SortedArray.hpp.
|
inline |
Insert the given value into the array if it doesn't already exist.
value | the value to insert. |
Definition at line 228 of file SortedArray.hpp.
|
inline |
Insert the values in [ first
, last
) into the array if they don't already exist.
ITER | The type of the iterator to use. |
first | Iterator to the first value to insert. |
last | Iterator to the end of the values to insert. |
first
, last
) must be sorted and unique. Definition at line 247 of file SortedArray.hpp.
|
inline |
Moves the SortedArrayView to the given execution space.
space | the space to move to. |
touch | If the values will be modified in the new space. |
touch
is set to false. using
statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC. Definition at line 333 of file SortedArray.hpp.
|
inline |
Copy assignment operator, performs a deep copy.
src | the SortedArray to copy. |
Definition at line 101 of file SortedArray.hpp.
|
inline |
Default move assignment operator, performs a shallow copy.
src | the SortedArray to be moved from. |
Definition at line 114 of file SortedArray.hpp.
|
inline |
Remove the given value from the array if it exists.
value | the value to remove. |
Definition at line 264 of file SortedArray.hpp.
|
inline |
Remove the values in [ first
, last
) from the array if they exist.
ITER | The type of the iterator to use. |
first | Iterator to the first value to remove. |
last | Iterator to the end of the values to remove. |
first
, last
) must be sorted and unique. Definition at line 283 of file SortedArray.hpp.
|
inline |
Reserve space to store the given number of values without resizing.
nVals | the number of values to reserve space for. |
Definition at line 316 of file SortedArray.hpp.
|
inline |
Set the name to be displayed whenever the underlying Buffer's user call back is called.
name | The name to associate with this SortedArray. |
Definition at line 342 of file SortedArray.hpp.
|
inline |
using
statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC. Definition at line 186 of file SortedArray.hpp.
|
inline |
using
statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC. Definition at line 135 of file SortedArray.hpp.
|
inlinedelete |
Overload for rvalues that is deleted.
SortedArrayView
would contain the buffer of the current SortedArray
that is about to be destroyed. This overload prevents that from happening.
|
inline |
using
statement is that it is detected using IS_VALID_EXPRESSION and this fails with NVCC. Definition at line 155 of file SortedArray.hpp.
|
inlinedelete |
Overload for rvalues that is deleted.
SortedArrayView
would contain the buffer of the current SortedArray
that is about to be destroyed. This overload prevents that from happening.