xentara-plugin v1.2.1
The Xentara Plugin Framework
|
A sentinel that protects write access to memory containing a heterogenious array. More...
#include <memory/WriteSentinel_Array.hpp>
Public Member Functions | |
WriteSentinel (const ArrayBlock &block) | |
Constructor. | |
WriteSentinel (const ArrayBlock &block, CopyOldValuesTag tag) | |
Constructor that copies the old values, if necessary. | |
~WriteSentinel ()=default | |
Destructor. | |
internal auto | operator[] (const Array::Handle &handle) const noexcept -> void * |
Gets a raw memory element. | |
template<typename Type > | |
auto | operator[] (const Array::ObjectHandle< Type > &handle) const noexcept -> Type & |
Gets an element containing a C++ object. | |
auto | commit () -> void |
Commits the changes. | |
auto | discard () -> void |
Discards any uncommitted changes. | |
auto | oldValues () const -> ConstArrayAccessor |
Creates an accessor for the old values of the block. | |
A sentinel that protects write access to memory containing a heterogenious array.
xentara::memory::WriteSentinel< Array >::WriteSentinel | ( | const ArrayBlock & | block | ) |
Constructor.
block | The memory block you wish to write to |
xentara::memory::WriteSentinel< Array >::WriteSentinel | ( | const ArrayBlock & | block, |
CopyOldValuesTag | tag | ||
) |
Constructor that copies the old values, if necessary.
This constructor will initialize the new values with copies of the old values.
block | The memory block you wish to write to |
tag | Always pass WriteSentinel::kCopyOldValues as this parameter |
|
default |
Destructor.
Discards any uncommitted changes.
auto xentara::memory::WriteSentinel< Array >::commit | ( | ) | -> void |
auto xentara::memory::WriteSentinel< Array >::discard | ( | ) | -> void |
auto xentara::memory::WriteSentinel< Array >::oldValues | ( | ) | const -> ConstArrayAccessor |
Creates an accessor for the old values of the block.
This function can be used to access the old values of the block for memory resources that write by allocating a new block and swapping it in for the old one on commit. For memory resources that write data in place, the returned object provides access to the same memory as the writer itself.
|
noexcept |
Gets a raw memory element.
handle | The element handle |
|
noexcept |
Gets an element containing a C++ object.
handle | The element handle |