xentara-plugin v1.2
The Xentara Plugin Framework
|
A memory block containing an array of elements. More...
#include <memory/ArrayBlock.hpp>
Public Types | |
using | ElementHandle = RawMemoryHandle |
A handle for accessing an array element. | |
template<typename Type > | |
using | ObjectElementHandle = ObjectHandle< Type > |
A handle for accessing an object array element. | |
template<ObjectType Object> | |
using | ObjectElementHandleFor = ObjectHandleFor< Object > |
A handle for accessing an object array element. | |
template<utils::tools::UnsignedIntegral Type> | |
using | BitFieldElementHandle = BitFieldHandle< Type > |
A handle for accessing a bit field array element. | |
template<BitFieldType BitField> | |
using | BitFieldElementHandleFor = BitFieldHandleFor< BitField > |
A handle for accessing a bit field array element. | |
using | BitElementHandle = BitHandle |
A handle for accessing a bit within a bit field array element. | |
Public Member Functions | |
MemoryBlock (std::reference_wrapper< const Array > array) noexcept | |
Default constructor. | |
MemoryBlock (std::reference_wrapper< const Array > array, std::nullptr_t) noexcept | |
Conversion from an null pointer. | |
MemoryBlock (MemoryBlock &&other) noexcept | |
Move constructor. | |
MemoryBlock (std::reference_wrapper< const Array > array, MemoryBlock &&other) noexcept | |
Pseudo-Move constructor that also updates the array. | |
~MemoryBlock ()=default | |
Destructor. | |
auto | operator= (MemoryBlock &&other) noexcept -> MemoryBlock &=default |
Move assignment operator. | |
auto | operator= (std::nullptr_t) noexcept -> MemoryBlock & |
Assignment operator for a null pointer. | |
auto | operator== (std::nullptr_t) const -> bool |
Comparison operator with a null pointer. | |
operator bool () const noexcept | |
Boolean operator. | |
auto | create (MemoryResource &memoryResource) -> Initializer< Array > |
Allocates memory for the array and default initializes the elements. | |
auto | destroy () noexcept -> void |
Destroys any created object and turns the object into a null object. | |
auto | initializer () -> Initializer< Array > |
Recovers the initializer for additional initialization. | |
auto | array () const -> const Array & |
returns the array associated with the block | |
auto | handle (const Array::Handle &elementHandle) const noexcept -> ElementHandle |
Returns a memory handle for an array element's memory. | |
template<typename Type > | |
auto | handle (const Array::ObjectHandle< Type > &objectHandle) const noexcept -> ObjectElementHandle< Type > |
Returns an object handle for an object array element's memory. | |
template<typename ObjectType , typename ObjectOrBaseType , typename MemberType > requires std::derived_from<ObjectType, ObjectOrBaseType> | |
auto | member (const Array::ObjectHandle< ObjectType > &objectHandle, MemberType ObjectOrBaseType::*member) const noexcept -> ObjectElementHandle< MemberType > |
Returns an object handle to a member of an object array element. | |
template<typename Type > requires utils::tools::UnsignedIntegral<Type> | |
auto | bits (const Array::ObjectHandle< Type > &baseObjectHandle, Type mask) const noexcept -> BitFieldElementHandle< Type > |
Returns a bit field handle for a bit field array element's memory. | |
template<typename Type > requires utils::tools::UnsignedIntegral<Type> | |
auto | bit (const Array::ObjectHandle< Type > &baseObjectHandle, Type mask) const noexcept -> BitElementHandle |
Returns a Boolean handle to single bit in a bit field array element's memory. | |
auto | memoryResource () const noexcept -> MemoryResource & |
Returns the memory resource that the block was allocated in. | |
auto | rawBlock () const noexcept -> const RawMemoryBlock & |
Returns the raw memory block that holds the array. | |
auto | rawBlock () noexcept -> RawMemoryBlock & |
Returns the raw memory block that holds the array. | |
Protected Member Functions | |
auto | blockTraits () const noexcept -> BlockTraits final |
Gets the size and alignment info for the block. | |
auto | constructAt (void *placement) const -> void final |
Called by the framework to construct a block in an existing placement. | |
auto | constructAt (void *placement, const void *init) const -> void final |
Called by the framework to construct a block in an existing placement using copy construction. | |
auto | destroyAt (void *placement) const noexcept -> void final |
Called by the framework to destroy the block in an existing placement. | |
A memory block containing an array of elements.
This class can be moved but not copied.
using xentara::memory::MemoryBlock< Array >::BitElementHandle = BitHandle |
A handle for accessing a bit within a bit field array element.
using xentara::memory::MemoryBlock< Array >::BitFieldElementHandle = BitFieldHandle<Type> |
A handle for accessing a bit field array element.
using xentara::memory::MemoryBlock< Array >::BitFieldElementHandleFor = BitFieldHandleFor<BitField> |
A handle for accessing a bit field array element.
using xentara::memory::MemoryBlock< Array >::ElementHandle = RawMemoryHandle |
A handle for accessing an array element.
using xentara::memory::MemoryBlock< Array >::ObjectElementHandle = ObjectHandle<Type> |
A handle for accessing an object array element.
using xentara::memory::MemoryBlock< Array >::ObjectElementHandleFor = ObjectHandleFor<Object> |
A handle for accessing an object array element.
|
noexcept |
Default constructor.
This constructor constructs a null object without an allocated block
array | The array that describes the contents |
|
noexcept |
Conversion from an null pointer.
This constructor constructs a null object without an allocated block
array | The array that describes the contents |
|
noexcept |
Move constructor.
This constructor transfers any allocated memory from other to this object. other is turned into as a null object without an allocated block.
|
noexcept |
Pseudo-Move constructor that also updates the array.
This constructor transfers any allocated memory from other to this object. other is turned into as a null object without an allocated block.
|
default |
Destructor.
Destroys any allocated array
auto xentara::memory::MemoryBlock< Array >::array | ( | ) | const -> const Array & |
returns the array associated with the block
|
noexcept |
Returns a Boolean handle to single bit in a bit field array element's memory.
baseObjectHandle | A handle to the base value containing the bit field |
mask | A mask describing the desired bit |
|
noexcept |
Returns a bit field handle for a bit field array element's memory.
baseObjectHandle | A handle to the base value containing the bit field |
mask | A mask describing the relevant bits |
|
finalprotectedvirtualnoexcept |
Gets the size and alignment info for the block.
Implements xentara::memory::MemoryResource::BlockHandler.
|
finalprotectedvirtual |
Called by the framework to construct a block in an existing placement.
placement | The placement of the block |
Implements xentara::memory::MemoryResource::BlockHandler.
|
finalprotectedvirtual |
Called by the framework to construct a block in an existing placement using copy construction.
placement | The placement of the block |
init | The placement of the block to copy. The block is guaranteed to have the same handler. |
Implements xentara::memory::MemoryResource::BlockHandler.
auto xentara::memory::MemoryBlock< Array >::create | ( | MemoryResource & | memoryResource | ) | -> Initializer<Array> |
Allocates memory for the array and default initializes the elements.
Any previously created object is destroyed
memoryResource | The memory resource to use |
|
noexcept |
Destroys any created object and turns the object into a null object.
Like operator new
and std::free(), this method can safely be called on null objects.
|
finalprotectedvirtualnoexcept |
Called by the framework to destroy the block in an existing placement.
placement | The placement of the block |
Implements xentara::memory::MemoryResource::BlockHandler.
|
noexcept |
Returns a memory handle for an array element's memory.
elementHandle | A handle to the element |
|
noexcept |
Returns an object handle for an object array element's memory.
objectHandle | A handle to the object |
auto xentara::memory::MemoryBlock< Array >::initializer | ( | ) | -> Initializer<Array> |
Recovers the initializer for additional initialization.
This function can be used to perform additional initialization of the array from code locations where the initializer returned from create() is not available.
|
noexcept |
Returns an object handle to a member of an object array element.
objectHandle | A handle to the object |
member | The member |
|
noexcept |
Returns the memory resource that the block was allocated in.
This function may not be called on null objects with no allocated block
|
explicitnoexcept |
Boolean operator.
This operator checks whether the object has an allocated memory block
|
defaultnoexcept |
Move assignment operator.
This operator swaps the allocated memory with other.
|
noexcept |
Assignment operator for a null pointer.
This operator deallocates any allocated data turns the object into a null object.
auto xentara::memory::MemoryBlock< Array >::operator== | ( | std::nullptr_t | ) | const -> bool |
Comparison operator with a null pointer.
This operator checks whether the object is a null object without an allocated block
|
noexcept |
Returns the raw memory block that holds the array.
|
noexcept |
Returns the raw memory block that holds the array.