This class implements an indexed-based constant accessor providing access to a subset of elements stored in an array.
More...
|
| ConstArraySubsetAccessor ()=default |
| Creates a new empty accessor. More...
|
|
| ConstArraySubsetAccessor (ConstArraySubsetAccessor< T, TIndex > &&accessor) noexcept |
| Move constructor. More...
|
|
| ConstArraySubsetAccessor (const T *elements, const TIndex *subsetIndices, const size_t subsetSize) |
| Creates a new accessor object. More...
|
|
| ConstArraySubsetAccessor (const T *elements, const std::vector< TIndex > &subsetIndices) |
| Creates a new accessor object. More...
|
|
| ConstArraySubsetAccessor (const std::vector< T > &elements, const std::vector< TIndex > &subsetIndices) |
| Creates a new accessor object. More...
|
|
virtual size_t | size () const |
| Returns the number of accessible elements of this accessor object. More...
|
|
virtual const T & | operator[] (const size_t &index) const |
| Returns one element of this accessor object. More...
|
|
ConstArraySubsetAccessor< T, TIndex > & | operator= (ConstArraySubsetAccessor< T, TIndex > &&accessor) noexcept |
| Move operator. More...
|
|
virtual bool | canAccess (const size_t &index) const |
| Returns whether this accessor has a specific element. More...
|
|
virtual bool | firstElement (T &element, size_t &index) const |
| Returns the first element of this accessor. More...
|
|
virtual bool | nextElement (const size_t &previousIndex, T &nextElement, size_t &nextIndex) const |
| Returns the next element which follows a given key of the previous element. More...
|
|
virtual const T * | data () const |
| Returns a pointer to the elements of this accessor if the data exists within one memory block without gaps. More...
|
|
virtual | ~Accessor ()=default |
| Default destructor. More...
|
|
bool | isEmpty () const |
| Returns whether this accessor provides no elements. More...
|
|
|
template<typename TAccessor > |
static std::vector< typename TAccessor::Type > | accessor2elements (const TAccessor &accessor) |
| Returns all elements of a given accessor (as a block). More...
|
|
template<typename TAccessor > |
static std::unordered_map< typename TAccessor::KeyType, typename TAccessor::Type > | accessor2map (const TAccessor &accessor) |
| Returns all elements of a given accessor as a map with key and elements. More...
|
|
template<typename TAccessor , typename TIndex > |
static std::vector< typename TAccessor::Type > | accessor2subsetElements (const TAccessor &accessor, const std::vector< TIndex > &subset) |
| Returns a subset of all elements of a given accessor (as a block). More...
|
|
| ConstIndexedAccessor ()=default |
| Creates a new indexed-based accessor object. More...
|
|
| ConstAccessor ()=default |
| Protected default constructor. More...
|
|
| Accessor ()=default |
| Protected default constructor. More...
|
|
| Accessor (const Accessor &accessor)=default |
| Protected copy constructor. More...
|
|
Accessor & | operator= (const Accessor &accessor)=delete |
| Deleted assign operator. More...
|
|
template<typename T, typename TIndex>
class Ocean::ConstArraySubsetAccessor< T, TIndex >
This class implements an indexed-based constant accessor providing access to a subset of elements stored in an array.
The subset is defined by a set of indices defining also the order of the accessible elements.
An instance of this accessor does not copy the elements or the subset indices, thus the caller has to ensure that the actual elements exist as long as the instance of the accessor exists.
- Template Parameters
-
T | The data type of the elements of the accessor |
TIndex | The data type of the indices defining the subset of elements |