xentara-plugin v2.0.4
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::memory::MemoryResource::Handle< kRole > Class Template Referencefinal

A handle used to access a memory block within a memory resource. More...

#include <xentara/memory/MemoryResource.hpp>

Public Types

using Storage = utils::memory::SizedStorage< kHandleDataSize< kRole > >
 The storage used for holding the handle data.
 

Public Member Functions

 Handle () noexcept
 Default constructor.
 
internal Handle (std::nullptr_t) noexcept
 Constructor for a null handle.
 
auto operator= (std::nullptr_t) noexcept -> Handle &
 Assignment operator for a nullptr
 
auto operator== (const Handle &rhs) const noexcept -> bool
 Comparison operator.
 
auto operator== (std::nullptr_t) const noexcept -> bool
 Comparison operator for a nullptr
 
 operator bool () const noexcept
 Checks whether the handle points to a block.
 
auto memoryResource () const noexcept -> MemoryResource &
 Gets the associeted memory resource.
 
auto swap (Handle &other) noexcept -> void
 Swaps the handle with another handle.
 

Detailed Description

template<HandleRole kRole>
class xentara::memory::MemoryResource::Handle< kRole >

A handle used to access a memory block within a memory resource.

Member Typedef Documentation

◆ Storage

template<HandleRole kRole>
using xentara::memory::MemoryResource::Handle< kRole >::Storage = utils::memory::SizedStorage<kHandleDataSize<kRole> >

The storage used for holding the handle data.

Constructor & Destructor Documentation

◆ Handle() [1/2]

template<HandleRole kRole>
xentara::memory::MemoryResource::Handle< kRole >::Handle ( )
noexcept

Default constructor.

Constructs a handle not associated with any memory

◆ Handle() [2/2]

template<HandleRole kRole>
internal xentara::memory::MemoryResource::Handle< kRole >::Handle ( std::nullptr_t  )
noexcept

Constructor for a null handle.

Constructs a handle not associated with any memory. This is equivalent to the default constructor.

Member Function Documentation

◆ memoryResource()

template<HandleRole kRole>
auto xentara::memory::MemoryResource::Handle< kRole >::memoryResource ( ) const -> MemoryResource &
noexcept

Gets the associeted memory resource.

◆ operator bool()

template<HandleRole kRole>
xentara::memory::MemoryResource::Handle< kRole >::operator bool ( ) const
explicitnoexcept

Checks whether the handle points to a block.

Returns
Returns true if the handle points to a block, and false if it is a null handle.

◆ operator=()

template<HandleRole kRole>
auto xentara::memory::MemoryResource::Handle< kRole >::operator= ( std::nullptr_t  ) -> Handle &
noexcept

Assignment operator for a nullptr

This turns the handle into a null handle not associated with any memory.

◆ operator==() [1/2]

template<HandleRole kRole>
auto xentara::memory::MemoryResource::Handle< kRole >::operator== ( const Handle< kRole > &  rhs) const -> bool
noexcept

Comparison operator.

Returns
Returns true if both handles refer to the same memory block, or if both are null handles

◆ operator==() [2/2]

template<HandleRole kRole>
auto xentara::memory::MemoryResource::Handle< kRole >::operator== ( std::nullptr_t  ) const -> bool
noexcept

Comparison operator for a nullptr

Returns
Returns true if the handle is a null handle not associated with any memory.

◆ swap()

template<HandleRole kRole>
auto xentara::memory::MemoryResource::Handle< kRole >::swap ( Handle< kRole > &  other) -> void
noexcept

Swaps the handle with another handle.