xentara-plugin v2.0.4
The Xentara Plugin Framework
|
A raw memory block. More...
#include <xentara/memory/RawMemoryBlock.hpp>
Public Types | |
using | Handle = RawMemoryHandle |
A handle for accessing the block. | |
Public Member Functions | |
MemoryBlock () noexcept=default | |
Default constructor. | |
MemoryBlock (std::nullptr_t) noexcept | |
Conversion from an null pointer. | |
MemoryBlock (MemoryBlock &&other) noexcept | |
Move constructor. | |
~MemoryBlock () | |
Destructor. | |
auto | operator= (MemoryBlock &&other) noexcept -> MemoryBlock & |
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, std::reference_wrapper< const MemoryResource::BlockHandler > handler) -> Initializer< RawMemory > |
Creates the block. | |
auto | destroy () noexcept -> void |
Destroys any allocated data and turns the block into a null block. | |
auto | initializer () -> Initializer< RawMemory > |
Recovers the initializer for additional initialization. | |
auto | handle (std::size_t offset=0) const noexcept -> Handle |
Returns the memory handle into the block's memory. | |
auto | memoryResource () const noexcept -> MemoryResource & |
Returns the memory resource that the block was allocated in. | |
auto | blockHandle () const noexcept -> const MemoryResource::BlockHandle & |
Returns an handle for the block containing the data. | |
A raw memory block.
This class can be moved but not copied.
using xentara::memory::MemoryBlock< RawMemory >::Handle = RawMemoryHandle |
A handle for accessing the block.
|
defaultnoexcept |
Default constructor.
This constructor constructs a null object without an allocated block
|
noexcept |
Conversion from an null pointer.
This constructor constructs a null object without an allocated block
|
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.
Destructor.
Deallocates any allocated memory
|
noexcept |
Returns an handle for the block containing the data.
auto xentara::memory::MemoryBlock< RawMemory >::create | ( | MemoryResource & | memoryResource, |
std::reference_wrapper< const MemoryResource::BlockHandler > | handler | ||
) | -> Initializer< RawMemory > |
Creates the block.
Any previously allocated memory is deallocated
memoryResource | The memory resource to use |
handler | The handler for the block. Must remain valid until destroy() is called. |
|
noexcept |
Destroys any allocated data and turns the block into a null block.
Like operator new
and std::free(), this method can safely be called on null objects.
|
noexcept |
Returns the memory handle into the block's memory.
offset | The offset from the beginning of the block's data |
auto xentara::memory::MemoryBlock< RawMemory >::initializer | ( | ) | -> Initializer<RawMemory> |
Recovers the initializer for additional initialization.
This function can be used to perform additional initialization of the memory from code locations where the initializer returned from allocate() is not available.
|
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
|
noexcept |
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< RawMemory >::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