xentara-plugin v2.0.4
The Xentara Plugin Framework
|
A sentinel that protects write access to memory containing a single C++ object. More...
#include <xentara/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 (std::chrono::system_clock::time_point timeStamp) -> void |
Commits the changes. | |
template<std::same_as< process::Event >... AdditionalEvents> requires (sizeof...(AdditionalEvents) > 0) | |
auto | commit (std::chrono::system_clock::time_point timeStamp, const AdditionalEvents &...additionalEvents) -> void |
Commits the changes, raising additional events. | |
auto | commit (std::chrono::system_clock::time_point timeStamp, std::span< std::reference_wrapper< const process::Event > > additionalEvents) -> void |
Commits the changes, raising a list of additional events. | |
auto | commit () -> void |
deprecated Deprecated overload of commit() that uses the current time as time stamp. | |
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 kCopyOldValues as this parameter |
|
default |
Destructor.
Discards any uncommitted changes.
auto xentara::memory::WriteSentinel< Object< Type > >::commit | ( | ) | -> void |
deprecated Deprecated overload of commit() that uses the current time as time stamp.
auto xentara::memory::WriteSentinel< Object< Type > >::commit | ( | std::chrono::system_clock::time_point | timeStamp | ) | -> void |
auto xentara::memory::WriteSentinel< Object< Type > >::commit | ( | std::chrono::system_clock::time_point | timeStamp, |
const AdditionalEvents &... | additionalEvents | ||
) | -> void |
Commits the changes, raising additional events.
This overload allows you to specify one or more additional events to raise together with any change events resulting from the commit. The change events and additional events will be raised atomically as a block, as described in process::Event::raise().
timeStamp | The time stamp to be used when raising events. |
additionalEvents | Additional events to raise together with the change events. |
auto xentara::memory::WriteSentinel< Object< Type > >::commit | ( | std::chrono::system_clock::time_point | timeStamp, |
std::span< std::reference_wrapper< const process::Event > > | additionalEvents | ||
) | -> void |
Commits the changes, raising a list of additional events.
This overload allows you to specify a list of additional events to raise together with any change events resulting from the commit. The change events and additional events will be raised atomically as a block, as described in process::Event::raise().
timeStamp | The time stamp to be used when raising events. |
additionalEvents | Additional events to raise together with the change events. |
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.