Ocean
|
This class implements an accessor that guarantees memory access to the elements of an indexed accessor object until the scope ends. More...
Public Member Functions | |
template<typename TAccessor > | |
ScopedConstMemoryAccessor (const TAccessor &accessor) | |
Creates a new scoped accessor object by a given indexed accessor object. More... | |
const T * | data () const |
Returns the pointer to the memory block providing the data of the accessor. More... | |
size_t | size () const |
Returns the number of elements the accessor provides. More... | |
const T & | operator[] (const size_t index) const |
Returns one element of this accessor. More... | |
operator bool () const | |
Returns whether this object provides access to at least one element of the accessor. More... | |
Protected Attributes | |
const T * | data_ = nullptr |
The pointer to the memory block of the accessor. More... | |
size_t | size_ = 0 |
The number of elements the accessor provides. More... | |
std::vector< T > | intermediateValues_ |
The individual elements of the accessor, if necessary. More... | |
This class implements an accessor that guarantees memory access to the elements of an indexed accessor object until the scope ends.
The memory access ensures that the entire data of the indexed accessor objects is provided as one memory block without any gaps.
Beware: The data of the given indexed accessor may be copied (if necessary) to ensure the functionality.
Thus, the accessible elements of this object may be clones/copies of the actual provided accessor object.
|
inlineexplicit |
Creates a new scoped accessor object by a given indexed accessor object.
accessor | The accessor object providing the data for this scoped object, ensure that the provided accessor exists at least until the scope ends |
TAccessor | The data type of the accessor providing the data, must be of type ConstIndexedAccessor<T>, or ConstTemplateArrayAccessor<T, size_t> or ConstTemplateArraySubsetAccessor<T, size_t> |
|
inline |
Returns the pointer to the memory block providing the data of the accessor.
|
inlineexplicit |
Returns whether this object provides access to at least one element of the accessor.
|
inline |
Returns one element of this accessor.
index | The index of the element, with range [0, size()) |
|
inline |
Returns the number of elements the accessor provides.
|
protected |
The pointer to the memory block of the accessor.
|
protected |
The individual elements of the accessor, if necessary.
|
protected |
The number of elements the accessor provides.