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 | |
ScopedNonconstMemoryAccessor (NonconstIndexedAccessor< T > &accessor) | |
Creates a new scoped accessor object by a given indexed accessor object. More... | |
ScopedNonconstMemoryAccessor (NonconstIndexedAccessor< T > *accessor, const size_t temporarySize=0) | |
Creates a new scoped accessor object by an optional indexed accessor object or creates an internal temporary memory with specified size. More... | |
~ScopedNonconstMemoryAccessor () | |
Destructs the scoped accessor object. More... | |
T * | data () |
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... | |
T & | operator[] (const size_t index) |
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 | |
NonconstIndexedAccessor< T > * | accessor_ = nullptr |
The given accessor object providing the data for this object, nullptr if no accessor object was provided during creation. More... | |
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. The connected indexed accessor object will hold the data of this accessor object after this object is disposed.
|
inlineexplicit |
Creates a new scoped accessor object by a given indexed accessor object.
accessor | The accessor object providing the data for this scoped object, the provided accessor needs to exist at least until the scope ends |
|
inlineexplicit |
Creates a new scoped accessor object by an optional indexed accessor object or creates an internal temporary memory with specified size.
accessor | The accessor object providing the data for this scoped object, the provided accessor needs to exist at least until the scope ends, nullptr to create an internal temporary memory without connected accessor |
temporarySize | The explicit size of the internal memory if no accessor is provided, does not have any meaning if an accessor is provided |
|
inline |
Destructs the scoped accessor object.
Further, the intermediate values of this object may be copied back to the accessor object, if necessary.
|
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 given accessor object providing the data for this object, nullptr if no accessor object was provided during creation.
|
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.