xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::memory::MemoryHandle< Bit > Class Referencefinal

A handle to a single bit of a byte located in a memory resource. More...

#include <memory/BitHandle.hpp>

Public Member Functions

 MemoryHandle () noexcept=default
 Default constructor.
 
 MemoryHandle (const ObjectHandle< std::uint8_t > &byteHandle, std::uint8_t mask) noexcept
 Creates a handle for a bit in a byte referenced by another handle.
 
template<utils::tools::UnsignedIntegral Type>
 MemoryHandle (const ObjectHandle< Type > &bitFieldHandle, Type mask) noexcept
 Creates a handle for a bit in an unsigned integer referenced by another handle.
 
 MemoryHandle (std::nullptr_t) noexcept
 Conversion from an null pointer.
 
auto operator= (std::nullptr_t) noexcept -> MemoryHandle &
 Assignment operator for a null pointer.
 
auto operator== (std::nullptr_t) const -> bool
 Comparison operator with a null pointer.
 
 operator bool () const noexcept
 Checks for a null handle.
 
auto operator== (const MemoryHandle &) const -> bool=default
 Comparison operator.
 
auto operator<=> (const MemoryHandle &) const -> auto=default
 Comparison operator.
 
auto memoryResource () const noexcept -> MemoryResource &
 Returns the memory resource that the data resides in.
 
constexpr auto blockHandle () const noexcept -> const MemoryResource::BlockHandle &
 Returns a a handle to the memory block that holds the data.
 
constexpr auto byteHandle () const noexcept -> const ObjectHandle< std::uint8_t > &
 Returns a handle to the byte containing the bit.
 
constexpr auto rawHandle () const noexcept -> const RawMemoryHandle &
 Returns a handle to the raw memory holding the object.
 
auto offset () const noexcept -> std::size_t
 Gets the offset of the byte containing the bit within the block data.
 
constexpr auto mask () const -> std::uint8_t
 Gets the mask describing the desired bit.
 

Detailed Description

A handle to a single bit of a byte located in a memory resource.

Constructor & Destructor Documentation

◆ MemoryHandle() [1/4]

xentara::memory::MemoryHandle< Bit >::MemoryHandle ( )
defaultnoexcept

Default constructor.

This constructor constructs a null handle

◆ MemoryHandle() [2/4]

xentara::memory::MemoryHandle< Bit >::MemoryHandle ( const ObjectHandle< std::uint8_t > &  byteHandle,
std::uint8_t  mask 
)
noexcept

Creates a handle for a bit in a byte referenced by another handle.

Parameters
byteHandleA handle to the byte containing the bit
maskA mask describing the desired bit. Must have exactly one bit set.

◆ MemoryHandle() [3/4]

template<utils::tools::UnsignedIntegral Type>
xentara::memory::MemoryHandle< Bit >::MemoryHandle ( const ObjectHandle< Type > &  bitFieldHandle,
Type  mask 
)
noexcept

Creates a handle for a bit in an unsigned integer referenced by another handle.

Parameters
bitFieldHandleA handle to the integer containing the bit
maskA mask describing the desired bit. Must have exactly one bit set.

◆ MemoryHandle() [4/4]

xentara::memory::MemoryHandle< Bit >::MemoryHandle ( std::nullptr_t  )
noexcept

Conversion from an null pointer.

This constructor constructs a null handle

Member Function Documentation

◆ blockHandle()

constexpr auto xentara::memory::MemoryHandle< Bit >::blockHandle ( ) const -> const MemoryResource::BlockHandle &
constexprnoexcept

Returns a a handle to the memory block that holds the data.

◆ byteHandle()

constexpr auto xentara::memory::MemoryHandle< Bit >::byteHandle ( ) const -> const ObjectHandle<std::uint8_t> &
constexprnoexcept

Returns a handle to the byte containing the bit.

◆ mask()

constexpr auto xentara::memory::MemoryHandle< Bit >::mask ( ) const -> std::uint8_t
constexpr

Gets the mask describing the desired bit.

◆ memoryResource()

auto xentara::memory::MemoryHandle< Bit >::memoryResource ( ) const -> MemoryResource &
noexcept

Returns the memory resource that the data resides in.

◆ offset()

auto xentara::memory::MemoryHandle< Bit >::offset ( ) const -> std::size_t
noexcept

Gets the offset of the byte containing the bit within the block data.

◆ operator bool()

xentara::memory::MemoryHandle< Bit >::operator bool ( ) const
explicitnoexcept

Checks for a null handle.

◆ operator<=>()

auto xentara::memory::MemoryHandle< Bit >::operator<=> ( const MemoryHandle< Bit > &  ) const -> auto=default
default

Comparison operator.

◆ operator=()

auto xentara::memory::MemoryHandle< Bit >::operator= ( std::nullptr_t  ) -> MemoryHandle &
noexcept

Assignment operator for a null pointer.

◆ operator==() [1/2]

auto xentara::memory::MemoryHandle< Bit >::operator== ( const MemoryHandle< Bit > &  ) const -> bool=default
default

Comparison operator.

◆ operator==() [2/2]

auto xentara::memory::MemoryHandle< Bit >::operator== ( std::nullptr_t  ) const -> bool

Comparison operator with a null pointer.

◆ rawHandle()

constexpr auto xentara::memory::MemoryHandle< Bit >::rawHandle ( ) const -> const RawMemoryHandle &
constexprnoexcept

Returns a handle to the raw memory holding the object.