CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::DynamicBitSet< Buffer > Class Template Reference

The DynamicBitSet, which similar to BitSet, but does not have the size in its type. More...

#include <CeresEngine/Foundation/Container/DynamicBitSet.hpp>

Classes

struct  bitref
 
struct  const_iterator
 
struct  iterator
 

Public Types

using buffer_type = Buffer
 
using word_type = typename buffer_type::value_type
 
using allocator_type = typename buffer_type::allocator_type
 
using size_type = size_t
 
using buffer_size_type = typename buffer_type::size_type
 

Public Member Functions

 DynamicBitSet (const allocator_type &alloc=allocator_type()) noexcept
 
 DynamicBitSet (const size_type size, word_type value=0, const allocator_type &alloc=allocator_type())
 
 DynamicBitSet (const DynamicBitSet &x)=default
 
DynamicBitSetoperator= (const DynamicBitSet &x)=default
 
 DynamicBitSet (DynamicBitSet &&x) noexcept
 
DynamicBitSetoperator= (DynamicBitSet &&x) noexcept
 
size_type size () const noexcept
 
buffer_size_type word_size () const noexcept
 
word_typedata () noexcept
 
const word_typedata () const noexcept
 
bool empty () const noexcept
 
size_t byte_size () const noexcept
 
const buffer_typebuffer () const
 
bool test (const size_type i) const noexcept
 Test single bit.
 
bool all () const noexcept
 All bits true?
 
bool any () const noexcept
 Any bits true?
 
bool none () const noexcept
 No bits true?
 
void set (const size_type i)
 
void reset (const size_type i)
 
void set (const size_type i, const bool b)
 
void flip (const size_type i)
 
void reserve (const size_type size)
 
void resize (const size_type size)
 
void push_back (const bool b)
 
void assign (const buffer_type &buf)
 
void append (const DynamicBitSet &other)
 
bool operator[] (const size_type i) const
 
bitref operator[] (const size_type i)
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void copy (iterator from, iterator to, const_iterator source)
 

Static Public Member Functions

static constexpr buffer_size_type word_size (const size_type size) noexcept
 Required word size for a given bit size.
 
static constexpr buffer_size_type word_index (const size_type i) noexcept
 Index of a word in buffer for a given bit index.
 
static constexpr uint8_t bit_index (const size_type i) noexcept
 Index of a bit within its word.
 
static constexpr word_type word_mask (const size_type index) noexcept
 Mask representing a mask for a given bit within its word.
 

Static Public Attributes

static constexpr uint8_t bits_per_word = sizeof(word_type) * 8
 

Private Attributes

buffer_type mBuffer
 
size_type mSize
 

Detailed Description

template<typename Buffer = Vector<uint32_t>>
class CeresEngine::DynamicBitSet< Buffer >

The DynamicBitSet, which similar to BitSet, but does not have the size in its type.

It's also similar to Vector<bool> but has more limited ways for modification.

To construct DynamicBitSet you need to provide a Vector-like container of unsigned integers as a template parameter. It needs to have random access. The value_type of the container determines the word type of the DynamicBitSet type.

Member Typedef Documentation

◆ allocator_type

template<typename Buffer = Vector<uint32_t>>
using CeresEngine::DynamicBitSet< Buffer >::allocator_type = typename buffer_type::allocator_type

◆ buffer_size_type

template<typename Buffer = Vector<uint32_t>>
using CeresEngine::DynamicBitSet< Buffer >::buffer_size_type = typename buffer_type::size_type

◆ buffer_type

template<typename Buffer = Vector<uint32_t>>
using CeresEngine::DynamicBitSet< Buffer >::buffer_type = Buffer

◆ size_type

template<typename Buffer = Vector<uint32_t>>
using CeresEngine::DynamicBitSet< Buffer >::size_type = size_t

◆ word_type

template<typename Buffer = Vector<uint32_t>>
using CeresEngine::DynamicBitSet< Buffer >::word_type = typename buffer_type::value_type

Constructor & Destructor Documentation

◆ DynamicBitSet() [1/4]

template<typename Buffer = Vector<uint32_t>>
CeresEngine::DynamicBitSet< Buffer >::DynamicBitSet ( const allocator_type alloc = allocator_type())
inlineexplicitnoexcept

◆ DynamicBitSet() [2/4]

template<typename Buffer = Vector<uint32_t>>
CeresEngine::DynamicBitSet< Buffer >::DynamicBitSet ( const size_type  size,
word_type  value = 0,
const allocator_type alloc = allocator_type() 
)
inlineexplicit

◆ DynamicBitSet() [3/4]

template<typename Buffer = Vector<uint32_t>>
CeresEngine::DynamicBitSet< Buffer >::DynamicBitSet ( const DynamicBitSet< Buffer > &  x)
default

◆ DynamicBitSet() [4/4]

template<typename Buffer = Vector<uint32_t>>
CeresEngine::DynamicBitSet< Buffer >::DynamicBitSet ( DynamicBitSet< Buffer > &&  x)
inlinenoexcept

Member Function Documentation

◆ all()

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::all ( ) const
inlinenoexcept

All bits true?

◆ any()

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::any ( ) const
inlinenoexcept

Any bits true?

◆ append()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::append ( const DynamicBitSet< Buffer > &  other)
inline

◆ assign()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::assign ( const buffer_type buf)
inline

◆ begin() [1/2]

template<typename Buffer = Vector<uint32_t>>
iterator CeresEngine::DynamicBitSet< Buffer >::begin ( )
inline

◆ begin() [2/2]

template<typename Buffer = Vector<uint32_t>>
const_iterator CeresEngine::DynamicBitSet< Buffer >::begin ( ) const
inline

◆ bit_index()

template<typename Buffer = Vector<uint32_t>>
static constexpr uint8_t CeresEngine::DynamicBitSet< Buffer >::bit_index ( const size_type  i)
inlinestaticconstexprnoexcept

Index of a bit within its word.

◆ buffer()

template<typename Buffer = Vector<uint32_t>>
const buffer_type & CeresEngine::DynamicBitSet< Buffer >::buffer ( ) const
inline

◆ byte_size()

template<typename Buffer = Vector<uint32_t>>
size_t CeresEngine::DynamicBitSet< Buffer >::byte_size ( ) const
inlinenoexcept

◆ copy()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::copy ( iterator  from,
iterator  to,
const_iterator  source 
)
inline

◆ data() [1/2]

template<typename Buffer = Vector<uint32_t>>
const word_type * CeresEngine::DynamicBitSet< Buffer >::data ( ) const
inlinenoexcept

◆ data() [2/2]

template<typename Buffer = Vector<uint32_t>>
word_type * CeresEngine::DynamicBitSet< Buffer >::data ( )
inlinenoexcept

◆ empty()

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::empty ( ) const
inlinenoexcept

◆ end() [1/2]

template<typename Buffer = Vector<uint32_t>>
iterator CeresEngine::DynamicBitSet< Buffer >::end ( )
inline

◆ end() [2/2]

template<typename Buffer = Vector<uint32_t>>
const_iterator CeresEngine::DynamicBitSet< Buffer >::end ( ) const
inline

◆ flip()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::flip ( const size_type  i)
inline

◆ none()

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::none ( ) const
inlinenoexcept

No bits true?

◆ operator=() [1/2]

template<typename Buffer = Vector<uint32_t>>
DynamicBitSet & CeresEngine::DynamicBitSet< Buffer >::operator= ( const DynamicBitSet< Buffer > &  x)
default

◆ operator=() [2/2]

template<typename Buffer = Vector<uint32_t>>
DynamicBitSet & CeresEngine::DynamicBitSet< Buffer >::operator= ( DynamicBitSet< Buffer > &&  x)
inlinenoexcept

◆ operator[]() [1/2]

template<typename Buffer = Vector<uint32_t>>
bitref CeresEngine::DynamicBitSet< Buffer >::operator[] ( const size_type  i)
inline

◆ operator[]() [2/2]

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::operator[] ( const size_type  i) const
inline

◆ push_back()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::push_back ( const bool  b)
inline

◆ reserve()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::reserve ( const size_type  size)
inline

◆ reset()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::reset ( const size_type  i)
inline

◆ resize()

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::resize ( const size_type  size)
inline

◆ set() [1/2]

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::set ( const size_type  i)
inline

◆ set() [2/2]

template<typename Buffer = Vector<uint32_t>>
void CeresEngine::DynamicBitSet< Buffer >::set ( const size_type  i,
const bool  b 
)
inline

◆ size()

template<typename Buffer = Vector<uint32_t>>
size_type CeresEngine::DynamicBitSet< Buffer >::size ( ) const
inlinenoexcept

◆ test()

template<typename Buffer = Vector<uint32_t>>
bool CeresEngine::DynamicBitSet< Buffer >::test ( const size_type  i) const
inlinenoexcept

Test single bit.

◆ word_index()

template<typename Buffer = Vector<uint32_t>>
static constexpr buffer_size_type CeresEngine::DynamicBitSet< Buffer >::word_index ( const size_type  i)
inlinestaticconstexprnoexcept

Index of a word in buffer for a given bit index.

◆ word_mask()

template<typename Buffer = Vector<uint32_t>>
static constexpr word_type CeresEngine::DynamicBitSet< Buffer >::word_mask ( const size_type  index)
inlinestaticconstexprnoexcept

Mask representing a mask for a given bit within its word.

◆ word_size() [1/2]

template<typename Buffer = Vector<uint32_t>>
buffer_size_type CeresEngine::DynamicBitSet< Buffer >::word_size ( ) const
inlinenoexcept

◆ word_size() [2/2]

template<typename Buffer = Vector<uint32_t>>
static constexpr buffer_size_type CeresEngine::DynamicBitSet< Buffer >::word_size ( const size_type  size)
inlinestaticconstexprnoexcept

Required word size for a given bit size.

Member Data Documentation

◆ bits_per_word

template<typename Buffer = Vector<uint32_t>>
constexpr uint8_t CeresEngine::DynamicBitSet< Buffer >::bits_per_word = sizeof(word_type) * 8
staticconstexpr

◆ mBuffer

template<typename Buffer = Vector<uint32_t>>
buffer_type CeresEngine::DynamicBitSet< Buffer >::mBuffer
private

◆ mSize

template<typename Buffer = Vector<uint32_t>>
size_type CeresEngine::DynamicBitSet< Buffer >::mSize
private

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