xentara-plugin v1.2.1
The Xentara Plugin Framework
|
A sentinel that protects write access to memory containing a single C++ object. More...
#include <memory/WriteSentinel_Object.hpp>
Public Types | |
using | TargetObject = memory::Object< Type > |
The object type describing the structure. | |
using | Element = typename TargetObject::Element |
The C++ object type. | |
Public Member Functions | |
WriteSentinel (const ObjectBlock< Type > &block) | |
Constructor. | |
WriteSentinel (const ObjectBlock< Type > &block, CopyOldValuesTag tag) | |
Constructor that copies the old values, if necessary. | |
~WriteSentinel ()=default | |
Destructor. | |
internal auto | get () const noexcept -> Element & |
Gets the object. | |
auto | operator* () const noexcept -> Element & |
Gets the object. | |
auto | operator-> () const noexcept -> Element * |
Member access operator. | |
auto | commit () -> void |
Commits the changes. | |
auto | discard () -> void |
Discards any uncommitted changes. | |
auto | oldValue () const -> const Element & |
Returns the old value of the block. | |
A sentinel that protects write access to memory containing a single C++ object.
using xentara::memory::WriteSentinel< Object< Type > >::Element = typename TargetObject::Element |
The C++ object type.
using xentara::memory::WriteSentinel< Object< Type > >::TargetObject = memory::Object<Type> |
The object type describing the structure.
xentara::memory::WriteSentinel< Object< Type > >::WriteSentinel | ( | const ObjectBlock< Type > & | block | ) |
Constructor.
block | The memory block you wish to write to |
xentara::memory::WriteSentinel< Object< Type > >::WriteSentinel | ( | const ObjectBlock< Type > & | 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< Object< Type > >::commit | ( | ) | -> void |
auto xentara::memory::WriteSentinel< Object< Type > >::discard | ( | ) | -> void |
|
noexcept |
Gets the object.
auto xentara::memory::WriteSentinel< Object< Type > >::oldValue | ( | ) | const -> const Element & |
Returns the old value of the block.
This function can be used to access the old value 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 the object.
|
noexcept |
Member access operator.