Open 3D Engine AzNetworking API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::FixedSizeBitset< SIZE, ElementType > Class Template Reference

fixed size data structure optimized for representing an array of bits. More...

#include <FixedSizeBitset.h>

Inherits AzNetworking::IBitset.

Public Types

using SelfType = FixedSizeBitset< SIZE, ElementType >
 
using ContainerType = AZStd::array< ElementType, ElementCount >
 

Public Member Functions

 FixedSizeBitset (bool value)
 
 FixedSizeBitset (const ElementType *values)
 
 FixedSizeBitset (const FixedSizeBitset< SIZE, ElementType > &rhs)
 
SelfTypeoperator= (const SelfType &rhs)
 
SelfTypeoperator|= (const SelfType &rhs)
 
bool operator== (const SelfType &rhs) const
 
bool operator!= (const SelfType &rhs) const
 
void InitializeAll (bool value)
 
void SetBit (uint32_t index, bool value) override
 
bool GetBit (uint32_t index) const override
 
bool AnySet () const override
 
uint32_t GetValidBitCount () const override
 
void Subtract (const FixedSizeBitset< SIZE, ElementType > &rhs)
 
const ContainerType & GetContainer () const
 
ContainerType & GetContainer ()
 
bool Serialize (ISerializer &serializer)
 
virtual void SetBit (uint32_t index, bool value)=0
 
virtual bool GetBit (uint32_t index) const =0
 
virtual bool AnySet () const =0
 
virtual uint32_t GetValidBitCount () const =0
 

Static Public Attributes

static const constexpr AZStd::size_t ElementTypeBits = sizeof(ElementType) * 8
 
static const constexpr AZStd::size_t ElementCount = (SIZE + ElementTypeBits - 1) / ElementTypeBits
 

Friends

template<AZStd::size_t , typename >
class FixedSizeVectorBitset
 

Detailed Description

template<AZStd::size_t SIZE, typename ElementType = uint32_t>
class AzNetworking::FixedSizeBitset< SIZE, ElementType >

fixed size data structure optimized for representing an array of bits.

Constructor & Destructor Documentation

◆ FixedSizeBitset() [1/3]

template<AZStd::size_t SIZE, typename ElementType >
AzNetworking::FixedSizeBitset< SIZE, ElementType >::FixedSizeBitset ( bool  value)
inline

Construct to a given initial state.

Parameters
valuevalue to initialize all bits to

◆ FixedSizeBitset() [2/3]

template<AZStd::size_t SIZE, typename ElementType >
AzNetworking::FixedSizeBitset< SIZE, ElementType >::FixedSizeBitset ( const ElementType *  values)
inline

Construct from an array of raw input.

Parameters
valuesraw input array to initialize bit vector to

◆ FixedSizeBitset() [3/3]

template<AZStd::size_t SIZE, typename ElementType >
AzNetworking::FixedSizeBitset< SIZE, ElementType >::FixedSizeBitset ( const FixedSizeBitset< SIZE, ElementType > &  rhs)
inline

Construct from another bit set.

Parameters
rhsbitset to copy

Member Function Documentation

◆ AnySet()

template<AZStd::size_t SIZE, typename ElementType >
bool AzNetworking::FixedSizeBitset< SIZE, ElementType >::AnySet
inlineoverridevirtual

Returns true if any of the bits are set.

Returns
boolean true if any bit is set, false otherwise

Implements AzNetworking::IBitset.

◆ GetBit()

template<AZStd::size_t SIZE, typename ElementType >
bool AzNetworking::FixedSizeBitset< SIZE, ElementType >::GetBit ( uint32_t  index) const
inlineoverridevirtual

Gets the current value of the specified bit.

Parameters
indexindex of the bit to retrieve the value of
Returns
boolean true if the bit is set, false otherwise

Implements AzNetworking::IBitset.

◆ GetContainer() [1/2]

template<AZStd::size_t SIZE, typename ElementType >
FixedSizeBitset< SIZE, ElementType >::ContainerType & AzNetworking::FixedSizeBitset< SIZE, ElementType >::GetContainer
inline

Non-const raw-buffer access.

Returns
non-const pointer to the raw buffer the bit array is stored in

◆ GetContainer() [2/2]

template<AZStd::size_t SIZE, typename ElementType >
const FixedSizeBitset< SIZE, ElementType >::ContainerType & AzNetworking::FixedSizeBitset< SIZE, ElementType >::GetContainer
inline

Const raw-buffer access.

Returns
const pointer to the raw buffer the bit array is stored in

◆ GetValidBitCount()

template<AZStd::size_t SIZE, typename ElementType >
uint32_t AzNetworking::FixedSizeBitset< SIZE, ElementType >::GetValidBitCount
inlineoverridevirtual

Returns the number of bits that are represented in this fixed size bitset.

Returns
the number of bits that are represented in this fixed size bitset

Implements AzNetworking::IBitset.

◆ InitializeAll()

template<AZStd::size_t SIZE, typename ElementType >
void AzNetworking::FixedSizeBitset< SIZE, ElementType >::InitializeAll ( bool  value)
inline

Initializes all internal bits to the provided value.

Parameters
valuevalue to initialize all bits to

◆ operator!=()

template<AZStd::size_t SIZE, typename ElementType >
bool AzNetworking::FixedSizeBitset< SIZE, ElementType >::operator!= ( const SelfType rhs) const

Inequality operator.

Parameters
rhsinstance to compare against
Returns
boolean true if inputs are different, false otherwise

◆ operator=()

template<AZStd::size_t SIZE, typename ElementType >
FixedSizeBitset< SIZE, ElementType > & AzNetworking::FixedSizeBitset< SIZE, ElementType >::operator= ( const SelfType rhs)

Assignment from same type.

Parameters
rhsinstance to assign from

◆ operator==()

template<AZStd::size_t SIZE, typename ElementType >
bool AzNetworking::FixedSizeBitset< SIZE, ElementType >::operator== ( const SelfType rhs) const

Equality operator.

Parameters
rhsinstance to compare against
Returns
boolean true if inputs are the same, false otherwise

◆ operator|=()

template<AZStd::size_t SIZE, typename ElementType >
FixedSizeBitset< SIZE, ElementType > & AzNetworking::FixedSizeBitset< SIZE, ElementType >::operator|= ( const SelfType rhs)

Bitwise OR assignment operator.

Parameters
rhsinstance to bitwise-or assign
Returns
reference to the LHS

◆ Serialize()

template<AZStd::size_t SIZE, typename ElementType >
bool AzNetworking::FixedSizeBitset< SIZE, ElementType >::Serialize ( ISerializer serializer)
inline

Base serialize method for all serializable structures or classes to implement.

Parameters
serializerISerializer instance to use for serialization
Returns
boolean true for success, false for serialization failure

◆ SetBit()

template<AZStd::size_t SIZE, typename ElementType >
void AzNetworking::FixedSizeBitset< SIZE, ElementType >::SetBit ( uint32_t  index,
bool  value 
)
inlineoverridevirtual

Sets the specified bit to the provided value.

Parameters
indexindex of the bit to set
valuevalue to set the bit to

Implements AzNetworking::IBitset.

◆ Subtract()

template<AZStd::size_t SIZE, typename ElementType >
void AzNetworking::FixedSizeBitset< SIZE, ElementType >::Subtract ( const FixedSizeBitset< SIZE, ElementType > &  rhs)
inline

Subtracts off the set bits of the passed in bitset.

Parameters
rhsthe bits that we want to remove from the current bitset

The documentation for this class was generated from the following files: