xentara-plugin v2.0.4
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::memory::ReadSentinel< Array > Class Referencefinal

A sentinel that protects read access to memory containing a heterogenious array. More...

#include <xentara/memory/ReadSentinel_Array.hpp>

+ Inheritance diagram for xentara::memory::ReadSentinel< Array >:

Public Member Functions

 ReadSentinel (const ArrayBlock &block)
 Constructor for a memory block.
 
internal auto operator[] (const Array::Handle &handle) const noexcept -> const void *
 Gets a raw memory element.
 
template<typename Type >
auto operator[] (const Array::ObjectHandle< Type > &handle) const noexcept -> const Type &
 Gets an element containing a C++ object.
 
auto end () -> void
 Ends reading prematurely.
 

Detailed Description

A sentinel that protects read access to memory containing a heterogenious array.

Note
Objects of this class can be moved, but not copied.

Constructor & Destructor Documentation

◆ ReadSentinel()

xentara::memory::ReadSentinel< Array >::ReadSentinel ( const ArrayBlock block)

Constructor for a memory block.

Parameters
blockThe memory block you wish to read from

Member Function Documentation

◆ end()

auto xentara::memory::ReadSentinel< Array >::end ( ) -> void

Ends reading prematurely.

Warning
Do not access the data after you have called end()!

◆ operator[]() [1/2]

internal auto xentara::memory::ReadSentinel< Array >::operator[] ( const Array::Handle handle) const -> const void *
noexcept

Gets a raw memory element.

Parameters
handleThe element handle
Returns
The placement of the corresponding element

◆ operator[]() [2/2]

template<typename Type >
auto xentara::memory::ReadSentinel< Array >::operator[] ( const Array::ObjectHandle< Type > &  handle) const -> const Type &
noexcept

Gets an element containing a C++ object.

Parameters
handleThe element handle
Returns
A reference to the corresponding element