![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cBitArray.h>
Public Types | |
typedef UINT32 | BLOCK_t |
The biggest unsigned type I can do atomic math on for this architecture. More... | |
typedef INT32 | BLOCKI_t |
The biggest signed type I can do atomic math on. More... | |
typedef WORD | BLOCKH_t |
half sized BLOCK_t for multiplication overflows. More... | |
typedef unsigned int | BLOCK_ENUM_t |
Type for the index of a BLOCK_t in the array. NOT bits BIT_ENUM_t. More... | |
Public Member Functions | |
cBitArrayStatic () noexcept | |
cBitArrayStatic (BIT_ENUM_t nBits) | |
cBitArrayStatic (BIT_ENUM_t nBits, BLOCK_t uValueMask) | |
cBitArrayStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pData) | |
cBitArrayStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocksInit, bool bStatic) | |
cBitArrayStatic (const THIS_t &ref) | |
cBitArrayStatic (THIS_t &&ref) noexcept | |
~cBitArrayStatic () | |
bool | isNullVal () const noexcept |
bool | isZeroVal () const noexcept |
BLOCK_ENUM_t | get_BlocksCap () const noexcept |
size_t | get_BytesCap () const noexcept |
BLOCK_t | GetBlockInt (BLOCK_ENUM_t i) const |
const BLOCK_t * | get_BlockPtrC () const noexcept |
BLOCK_t * | get_BlockPtr () |
BLOCK_t & | RefBlockInt (BLOCK_ENUM_t i) |
UINT32 | GetU32Int (BLOCK_ENUM_t j) const |
void | SetU32Int (BLOCK_ENUM_t j, UINT32 val32) |
const THIS_t & | operator= (const THIS_t &ref) |
THIS_t & | operator= (THIS_t &&ref) |
bool | isStatic () const noexcept |
void | SetBlocksStatic (BLOCK_ENUM_t nBlocks, const BLOCK_t *pBlocks) |
bool | isReadOnly () const noexcept |
BIT_ENUM_t | get_BitsCap () const noexcept |
bool | IsValidBit (BIT_ENUM_t nBit) const noexcept |
bool | IsSet (BIT_ENUM_t nBit) const |
bool | isOdd () const |
void | ClrBit (BIT_ENUM_t nBit) |
void | SetBit (BIT_ENUM_t nBit) |
bool | SetBitRet (BIT_ENUM_t nBit) |
void | ModBit (BIT_ENUM_t nBit, bool bVal) |
void | SetNullVal () noexcept |
void | SetZeroAll () |
void | SetAll1 () |
void | SetBitsSizeZ (BIT_ENUM_t nBits) |
void | SetInvertBytes (size_t nSize) |
void | SetCopyBits (const THIS_t &ref) |
Static Public Member Functions | |
static BLOCK_ENUM_t | GetBlocksFromBits (BIT_ENUM_t nBits) noexcept |
static BLOCK_ENUM_t | GetBlocksFromBytes (size_t nBytes) noexcept |
static bool | IsReasonableBlockQty (BLOCK_ENUM_t nBlocks) noexcept |
![]() | |
static constexpr size_t | GetSizeBytes (BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static constexpr TYPE | Mask1 (BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | IsMask1 (TYPE nVal) noexcept |
template<typename TYPE > | |
static constexpr bool | IsSet (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | IsClear (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr TYPE | SetBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr TYPE | ClearBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | HasMask (TYPE nVal, TYPE nMask) noexcept |
template<typename TYPE > | |
static BIT_ENUM_t | Highest1Bit (TYPE nMask) noexcept |
template<typename TYPE > | |
static BIT_ENUM_t | Count1Bits (TYPE nMask) noexcept |
template<typename TYPE > | |
static TYPE | Rotl (TYPE nVal, BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static TYPE | Rotr (TYPE nVal, BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static TYPE | Reverse (TYPE nVal) noexcept |
template<> | |
BIT_ENUM_t | Count1Bits (UINT32 nVal) noexcept |
template<> | |
BYTE | Reverse (BYTE nVal) noexcept |
template<> | |
UINT32 | Reverse (UINT32 nVal) noexcept |
template<> | |
ULONG | Reverse (ULONG nVal) noexcept |
Static Public Attributes | |
static const BLOCK_ENUM_t | k_BLOCK_MAX = 8096 |
Arbitrary Max reasonable size. More... | |
static const size_t | k_SIZE_MAX = k_BLOCK_MAX * sizeof(BLOCK_t) |
static const BIT_ENUM_t | k_BIT_MAX = k_SIZE_MAX * 8 |
static const cBitArrayStatic | k_Zero |
static const BLOCK_t | k_OneBlock = 1 |
static const BIT_ENUM_t | k_BLOCK_BITS = (BIT_ENUM_t)(sizeof(BLOCK_t) * 8) |
The number of bits in a BLOCK_t, BIT_ENUM_t. More... | |
static const BIT_ENUM_t | k_BLOCKH_BITS = (BIT_ENUM_t)(sizeof(BLOCKH_t) * 8) |
The number of bits in a BLOCKH_t, BIT_ENUM_t. More... | |
![]() | |
static const BYTE | k_8 = 8 |
represent the 8 bits in a byte. BIT_ENUM_t More... | |
Protected Member Functions | |
bool | IsValidBlockIndex (BLOCK_ENUM_t i) const noexcept |
void | SetBlockSizeReAlloc (BLOCK_ENUM_t nBlocksNew) |
void | SetBlockSizeUninit (BLOCK_ENUM_t nBlocksNew) |
void | SetBlockSizeGrow (BLOCK_ENUM_t nBlocksNew) |
BLOCK_ENUM_t | FindUsedBlocksQty (BLOCK_ENUM_t nBlocks) const |
BLOCK_ENUM_t | FindUsedBlocksQty () const |
An arbitrary sized array of boolean values. Large Bit array that does NOT dynamically resize.
typedef unsigned int GrayLib::cBitArrayStatic::BLOCK_ENUM_t |
Type for the index of a BLOCK_t in the array. NOT bits BIT_ENUM_t.
typedef UINT32 GrayLib::cBitArrayStatic::BLOCK_t |
The biggest unsigned type I can do atomic math on for this architecture.
typedef WORD GrayLib::cBitArrayStatic::BLOCKH_t |
half sized BLOCK_t for multiplication overflows.
typedef INT32 GrayLib::cBitArrayStatic::BLOCKI_t |
The biggest signed type I can do atomic math on.
|
inlinenoexcept |
construct empty.
|
inlineexplicit |
|
inline |
Init just the first blocks bits with uValueMask. Small value.
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
move constructor
|
inline |
free if ! m_bStatic
|
inline |
The size does NOT auto shrink/grow.
|
inlineprotected |
Find the highest non zero block. AKA get_BlocksUse() _DEBUG usage only?
|
inlineprotected |
Find the highest non zero block. _DEBUG usage only?
|
inlinenoexcept |
Get Max bits declared.
|
inline |
Get a pointer I could modify. Dangerous !!
|
inlinenoexcept |
Get a pointer I could read. slightly dangerous.
|
inlinenoexcept |
Get Max blocks i could use. allocated
|
inlinenoexcept |
|
inline |
|
inlinestaticnoexcept |
Number of blocks to hold this many bits. round up.
|
inlinestaticnoexcept |
Number of blocks to hold this many bytes. round up.
|
inline |
Treat blocks as an array of UINT32.
|
inlinenoexcept |
|
inline |
|
inlinenoexcept |
isStatic does not necessarily mean read only. If the blocks are in read only memory. CPU memory protection will just throw its own exception if we try to modify it..
|
inlinestaticnoexcept |
check for a max reasonable size.
|
inline |
Gets the state of the enumerated bit. which has value 2^nBit. Bits beyond get_BitsCap are considered to be 0.
|
inlinenoexcept |
I don't free this. but i might be able to modify it. (mapped into stack/static space)
|
inlinenoexcept |
Might i set/read this bit?
|
inlineprotectednoexcept |
|
inlinenoexcept |
|
inline |
Sets the state of bit to bVal The size does NOT auto shrink/grow.
|
inline |
Get a reference I could modify. MUST call UpdateBlocksUse() at some point after this. ASSUME we already have this many blocks.
|
inline |
Set all bits to 1.
|
inline |
Set a bit true in known valid bit range. no grow.
bool GrayLib::cBitArrayStatic::SetBitRet | ( | BIT_ENUM_t | nBit | ) |
Set a bit and return the previous value.
|
inline |
Create New/Clear/Zeroed bit array to hold nBits.
|
protected |
Grow Size. Zero fill new. but leave existing.
|
protected |
Keep any existing data. resize. I intend to modify this.
|
protected |
void GrayLib::cBitArrayStatic::SetBlocksStatic | ( | BLOCK_ENUM_t | nBlocks, |
const BLOCK_t * | pBlocks | ||
) |
Set to some static value. ASSERT if nBlocks is not a reasonable size.
void GrayLib::cBitArrayStatic::SetCopyBits | ( | const THIS_t & | ref | ) |
void GrayLib::cBitArrayStatic::SetInvertBytes | ( | size_t | nSize | ) |
|
noexcept |
|
inline |
Treat blocks as an array of UINT32.
|
inline |
Set all bits to 0. cMem::Zero(m_pBlocks, get_BytesCap());
|
static |
|
static |
The number of bits in a BLOCK_t, BIT_ENUM_t.
|
static |
Arbitrary Max reasonable size.
|
static |
The number of bits in a BLOCKH_t, BIT_ENUM_t.
|
static |
|
static |
|
static |