xentara-plugin v2.0.4
The Xentara Plugin Framework
|
A sentinel that protects write access to raw memory. More...
#include <xentara/memory/WriteSentinel_RawMemory.hpp>
Public Member Functions | |
WriteSentinel (const RawMemoryBlock &block) | |
Constructor. | |
WriteSentinel (const RawMemoryBlock &block, CopyOldValuesTag tag) | |
Constructor that copies the old values, if necessary. | |
~WriteSentinel () | |
Destructor. | |
internal 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 | placement () const noexcept -> void * |
Gets the placement of the containing data. | |
auto | oldData () const -> const void * |
Gets a pointer to the old data of the block. | |
A sentinel that protects write access to raw memory.
xentara::memory::WriteSentinel< RawMemory >::WriteSentinel | ( | const RawMemoryBlock & | block | ) |
Constructor.
block | The memory block you wish to write to |
xentara::memory::WriteSentinel< RawMemory >::WriteSentinel | ( | const RawMemoryBlock & | 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 |
Destructor.
Discards any uncommitted changes.
auto xentara::memory::WriteSentinel< RawMemory >::commit | ( | ) | -> void |
deprecated Deprecated overload of commit() that uses the current time as time stamp.
internal auto xentara::memory::WriteSentinel< RawMemory >::commit | ( | std::chrono::system_clock::time_point | timeStamp | ) | -> void |
auto xentara::memory::WriteSentinel< RawMemory >::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<std::same_as<process::Event>...>(std::chrono::system_clock::time_point, const Events &...) "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< RawMemory >::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< RawMemory >::discard | ( | ) | -> void |
auto xentara::memory::WriteSentinel< RawMemory >::oldData | ( | ) | const -> const void * |
Gets a pointer to the old data of the block.
This function can be used to access the old data 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 pointer is the same as placement().
|
noexcept |
Gets the placement of the containing data.