|
Ocean
|
This class implements an accessor providing direct access to a constant array of elements while all elements are identical (all elements point to one unique object). More...
#include <Accessor.h>
Public Member Functions | |
| ConstElementAccessor ()=default | |
| Creates a new empty accessor. | |
| ConstElementAccessor (ConstElementAccessor< T > &&accessor) noexcept | |
| Move constructor. | |
| ConstElementAccessor (const size_t size, const T &element) | |
| Creates a new accessor object. | |
| virtual size_t | size () const |
| Returns the number of accessible elements of this accessor object. | |
| virtual const T & | operator[] (const size_t &index) const |
| Returns one element of this accessor object. | |
| ConstElementAccessor< T > & | operator= (ConstElementAccessor< T > &&accessor) noexcept |
| Move operator. | |
Public Member Functions inherited from Ocean::ConstIndexedAccessor< T > | |
| virtual bool | canAccess (const size_t &index) const |
| Returns whether this accessor has a specific element. | |
| virtual bool | firstElement (T &element, size_t &index) const |
| Returns the first element of this accessor. | |
| 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. | |
Public Member Functions inherited from Ocean::ConstAccessor< T, size_t > | |
| virtual const T * | data () const |
| Returns a pointer to the elements of this accessor if the data exists within one memory block without gaps. | |
Public Member Functions inherited from Ocean::Accessor | |
| virtual | ~Accessor ()=default |
| Default destructor. | |
| bool | isEmpty () const |
| Returns whether this accessor provides no elements. | |
Protected Attributes | |
| const T * | element_ = nullptr |
| The element of this accessor. | |
| size_t | size_ = 0 |
| The number of elements that can be accessed. | |
Additional Inherited Members | |
Public Types inherited from Ocean::ConstAccessor< T, size_t > | |
| using | Type = T |
| Definition of the element type of this accessor. | |
| using | KeyType = size_t |
| Definition of the key (or e.g., index) type of this accessor. | |
Static Public Member Functions inherited from Ocean::Accessor | |
| template<typename TAccessor > | |
| static std::vector< typename TAccessor::Type > | accessor2elements (const TAccessor &accessor) |
| Returns all elements of a given accessor (as a block). | |
| 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. | |
| 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). | |
Protected Member Functions inherited from Ocean::ConstIndexedAccessor< T > | |
| ConstIndexedAccessor ()=default | |
| Creates a new indexed-based accessor object. | |
Protected Member Functions inherited from Ocean::ConstAccessor< T, size_t > | |
| ConstAccessor ()=default | |
| Protected default constructor. | |
Protected Member Functions inherited from Ocean::Accessor | |
| Accessor ()=default | |
| Protected default constructor. | |
| Accessor (const Accessor &accessor)=default | |
| Protected copy constructor. | |
| Accessor & | operator= (const Accessor &accessor)=delete |
| Deleted assign operator. | |
This class implements an accessor providing direct access to a constant array of elements while all elements are identical (all elements point to one unique object).
This accessor can be used to simulate a large array with several identical entries.
|
default |
Creates a new empty accessor.
|
inlinenoexcept |
Move constructor.
| accessor | Accessor to be moved |
|
inline |
Creates a new accessor object.
Beware: The given elements are not copied, they must not be deleted before the accessor is disposed.
| size | The number of elements that can be accessed, with range [1, infinity) |
| element | The element that can be accessed though any index |
|
inlinenoexcept |
|
virtual |
Returns one element of this accessor object.
Implements Ocean::ConstIndexedAccessor< T >.
|
virtual |
Returns the number of accessible elements of this accessor object.
Implements Ocean::Accessor.
|
protected |
The element of this accessor.
|
protected |
The number of elements that can be accessed.