PixelLightAPI
.
|
Bit set class. More...
#include <Bitset.h>
Public Member Functions | |
Bitset (uint32 nMaxNumOfElements=0, bool bAdded=true, bool bInit=false) | |
Constructor. | |
Bitset (const Bitset &lstSource, uint32 nStart=0, uint32 nCount=0) | |
Copy constructor. | |
Bitset (const Container< bool > &lstSource, uint32 nStart=0, uint32 nCount=0) | |
Copy constructor. | |
virtual | ~Bitset () |
Destructor. | |
Container< bool > & | operator= (const Bitset &lstSource) |
Copy operator. | |
uint32 | GetMaxNumOfElements () const |
Returns the maximum number of elements in the bit set. | |
bool | Resize (uint32 nMaxNumOfElements, bool bAdded=true, bool bInit=false) |
Sets the maximum number of elements in the bit set. | |
uint32 | GetResizeCount () const |
Returns the number of elements automatically added if the bit set size is to small. | |
bool | SetResizeCount (uint32 nCount=64) |
Sets the number of elements automatically added if the bit set size is to small. | |
bool | Clear (uint32 nIndex) |
Clears a bit to 0. | |
void | ClearAll () |
Clears all bits to 0. | |
bool | Set (uint32 nIndex) |
Sets the desired bit. | |
void | SetAll () |
Sets all bits to 1. | |
bool | Invert (uint32 nIndex) |
Inverts the desired bit. | |
void | InvertAll () |
Inverts all bits. | |
bool | IsSet (uint32 nIndex) const |
Returns if the desired bit slot is a 1 or a 0. | |
uint32 | GetNumOfSetBits () const |
Returns the number of set bits (value = 'true') | |
uint32 | GetNumOfIntegers () const |
Returns the internal number of integers (32 bit) used to store the bits. | |
const uint32 * | GetIntegers () const |
Returns the internal integers (32 bit) used to store the bits. | |
void | Reset () |
Resets the bitset. | |
virtual Iterator< bool > | GetIterator (uint32 nIndex=0) const override |
Returns an iterator operating on the derived data structure. | |
virtual ConstIterator< bool > | GetConstIterator (uint32 nIndex=0) const override |
Returns a constant iterator operating on the derived data structure. | |
virtual Iterator< bool > | GetEndIterator () const override |
Returns an iterator operating on the derived data structure and starting at the end. | |
virtual ConstIterator< bool > | GetConstEndIterator () const override |
Returns a constant iterator operating on the derived data structure and starting at the end. | |
virtual bool | IsEmpty () const |
Checks whether the container is complete empty. | |
virtual uint32 | GetNumOfElements () const |
Returns the number of elements. | |
virtual uint32 | GetElementSize () const |
Returns the size of a single container element (in bytes) | |
virtual uint32 | GetSize () const |
Returns the total size of all container elements (in bytes) | |
virtual void | Clear () override |
Clears the whole container. | |
virtual bool | IsElement (const bool &Element) const |
Returns whether the given element is within the container or not. | |
virtual int | GetIndex (const bool &Element) const |
Returns the index of an element (first appearance) | |
virtual bool & | Get (uint32 nIndex) const |
Returns an element. | |
virtual bool & | operator[] (uint32 nIndex) const |
Returns an element. | |
virtual bool | Replace (const bool &Element1, const bool &Element2) |
Replaces an element (first appearance) through another element. | |
virtual bool | ReplaceAtIndex (uint32 nIndex, const bool &Element) |
Replaces an element at the given index through another element. | |
virtual bool & | Add () override |
Appends an element to the container. | |
virtual bool & | Add (const bool &Element) override |
Appends an element to the container. | |
virtual uint32 | Add (const bool *pElements, uint32 nCount) override |
Adds elements from a given C-array. | |
virtual Container< bool > & | operator+= (const bool &Element) |
Appends an element to the container. | |
virtual bool | Add (const Container< bool > &lstContainer, uint32 nStart=0, uint32 nCount=0) override |
Appends an container to this container. | |
virtual Container< bool > & | operator+= (const Container< bool > &lstContainer) |
Appends an container to this container. | |
virtual bool & | AddAtIndex (int nIndex) override |
Appends an element to the container at the given index. | |
virtual bool & | AddAtIndex (const bool &Element, int nIndex) override |
Appends an element to the container at the given index. | |
virtual bool | Remove (const bool &Element) |
Removes an element (first appearance) from the container. | |
virtual bool | RemoveAtIndex (uint32 nElement) override |
Removes the element at the given index from the container. | |
virtual Container< bool > & | operator-= (const bool &Element) |
Removes an element from the container. | |
virtual bool | Remove (const Container< bool > &lstContainer, uint32 nStart=0, uint32 nCount=0) override |
Removes the elements of an container from this container. | |
virtual Container< bool > & | operator-= (const Container< bool > &lstContainer) |
Removes the elements of an container from this container. | |
virtual bool | Copy (const Container< bool > &lstContainer, uint32 nStart=0, uint32 nCount=0) override |
Makes this container to a copy of another container. | |
virtual Container< bool > & | operator= (const Container< bool > &lstContainer) |
Makes this container to a copy of another container. | |
virtual bool | Compare (const Container< bool > &lstContainer, uint32 nStart=0, uint32 nCount=0) const override |
Compares two containers. | |
virtual bool | operator== (const Container< bool > &lstContainer) const |
Compares two containers. | |
virtual bool | operator!= (const Container< bool > &lstContainer) const |
Compares two containers. |
Bit set class.
PLCore::Bitset::Bitset | ( | uint32 | nMaxNumOfElements = 0 , |
bool | bAdded = true , |
||
bool | bInit = false |
||
) |
[in] | nMaxNumOfElements | Maximum number of elements within the bit set |
[in] | bAdded | Are all elements added? (GetNumOfElements() = GetMaxNumOfElements()) |
[in] | bInit | Initialize new elements by setting them to null? |
PLCore::Bitset::Bitset | ( | const Bitset & | lstSource, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) |
Copy constructor.
[in] | lstSource | Bitset to copy from |
[in] | nStart | Index the copy operation should start |
[in] | nCount | Number of elements to copy, if 0 copy all elements of lstSource behind nStart |
PLCore::Bitset::Bitset | ( | const Container< bool > & | lstSource, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) |
Copy constructor.
[in] | lstSource | Container to copy from |
[in] | nStart | Index the copy operation should start |
[in] | nCount | Number of elements to copy, if 0 copy all elements of lstSource behind nStart |
virtual PLCore::Bitset::~Bitset | ( | ) | [virtual] |
Destructor.
uint32 PLCore::Bitset::GetMaxNumOfElements | ( | ) | const [inline] |
Returns the maximum number of elements in the bit set.
bool PLCore::Bitset::Resize | ( | uint32 | nMaxNumOfElements, |
bool | bAdded = true , |
||
bool | bInit = false |
||
) |
Sets the maximum number of elements in the bit set.
[in] | nMaxNumOfElements | New maximum number of elements (0 = clear bit set) |
[in] | bAdded | Are all elements added? (GetNumOfElements() = GetMaxNumOfElements()) |
[in] | bInit | Initialize new elements by setting them to null? |
uint32 PLCore::Bitset::GetResizeCount | ( | ) | const [inline] |
Returns the number of elements automatically added if the bit set size is to small.
bool PLCore::Bitset::SetResizeCount | ( | uint32 | nCount = 64 | ) | [inline] |
Sets the number of elements automatically added if the bit set size is to small.
[in] | nCount | Number of elements automatically added if the bit set size is to small |
bool PLCore::Bitset::Clear | ( | uint32 | nIndex | ) | [inline] |
Clears a bit to 0.
[in] | nIndex | Index of the bit to clear |
void PLCore::Bitset::ClearAll | ( | ) |
Clears all bits to 0.
bool PLCore::Bitset::Set | ( | uint32 | nIndex | ) | [inline] |
Sets the desired bit.
[in] | nIndex | Index of the bit to set |
void PLCore::Bitset::SetAll | ( | ) |
Sets all bits to 1.
bool PLCore::Bitset::Invert | ( | uint32 | nIndex | ) | [inline] |
Inverts the desired bit.
[in] | nIndex | Index of the bit to invert |
void PLCore::Bitset::InvertAll | ( | ) | [inline] |
Inverts all bits.
bool PLCore::Bitset::IsSet | ( | uint32 | nIndex | ) | const [inline] |
Returns if the desired bit slot is a 1 or a 0.
[in] | nIndex | Index of the bit to check |
uint32 PLCore::Bitset::GetNumOfSetBits | ( | ) | const |
Returns the number of set bits (value = 'true')
uint32 PLCore::Bitset::GetNumOfIntegers | ( | ) | const [inline] |
Returns the internal number of integers (32 bit) used to store the bits.
const uint32 * PLCore::Bitset::GetIntegers | ( | ) | const [inline] |
Returns the internal integers (32 bit) used to store the bits.
void PLCore::Bitset::Reset | ( | ) | [inline] |
Resets the bitset.
virtual Iterator<bool> PLCore::Bitset::GetIterator | ( | uint32 | nIndex = 0 | ) | const [override, virtual] |
Returns an iterator operating on the derived data structure.
[in] | nIndex | Start index, if >= 'total number of elements' the index is set to the last valid index |
Implements PLCore::Iterable< bool >.
virtual ConstIterator<bool> PLCore::Bitset::GetConstIterator | ( | uint32 | nIndex = 0 | ) | const [override, virtual] |
Returns a constant iterator operating on the derived data structure.
[in] | nIndex | Start index, if >= 'total number of elements' the index is set to the last valid index |
Implements PLCore::Iterable< bool >.
virtual Iterator<bool> PLCore::Bitset::GetEndIterator | ( | ) | const [override, virtual] |
Returns an iterator operating on the derived data structure and starting at the end.
Implements PLCore::Iterable< bool >.
virtual ConstIterator<bool> PLCore::Bitset::GetConstEndIterator | ( | ) | const [override, virtual] |
Returns a constant iterator operating on the derived data structure and starting at the end.
Implements PLCore::Iterable< bool >.
bool PLCore::Bitset::IsEmpty | ( | ) | const [inline, virtual] |
Checks whether the container is complete empty.
Implements PLCore::Container< bool >.
uint32 PLCore::Bitset::GetNumOfElements | ( | ) | const [inline, virtual] |
Returns the number of elements.
Implements PLCore::Container< bool >.
uint32 PLCore::Bitset::GetElementSize | ( | ) | const [inline, virtual] |
Returns the size of a single container element (in bytes)
Implements PLCore::Container< bool >.
uint32 PLCore::Bitset::GetSize | ( | ) | const [inline, virtual] |
Returns the total size of all container elements (in bytes)
Implements PLCore::Container< bool >.
virtual void PLCore::Bitset::Clear | ( | ) | [override, virtual] |
Clears the whole container.
Implements PLCore::Container< bool >.
bool PLCore::Bitset::IsElement | ( | const bool & | Element | ) | const [inline, virtual] |
Returns whether the given element is within the container or not.
Implements PLCore::Container< bool >.
int PLCore::Bitset::GetIndex | ( | const bool & | Element | ) | const [inline, virtual] |
Returns the index of an element (first appearance)
Implements PLCore::Container< bool >.
bool & PLCore::Bitset::Get | ( | uint32 | nIndex | ) | const [inline, virtual] |
Returns an element.
[in] | nIndex | Index of the element to return |
Implements PLCore::Container< bool >.
bool & PLCore::Bitset::operator[] | ( | uint32 | nIndex | ) | const [inline, virtual] |
Returns an element.
[in] | nIndex | Index of the element to return |
Implements PLCore::Container< bool >.
bool PLCore::Bitset::Replace | ( | const bool & | Element1, |
const bool & | Element2 | ||
) | [inline, virtual] |
Replaces an element (first appearance) through another element.
[in] | Element1 | Element to replace |
[in] | Element2 | The element which should replace the old one |
Implements PLCore::Container< bool >.
bool PLCore::Bitset::ReplaceAtIndex | ( | uint32 | nIndex, |
const bool & | Element | ||
) | [inline, virtual] |
Replaces an element at the given index through another element.
[in] | nIndex | Index of the element to replace |
[in] | Element | The element which should replace the old one |
Implements PLCore::Container< bool >.
virtual bool& PLCore::Bitset::Add | ( | ) | [override, virtual] |
Appends an element to the container.
Implements PLCore::Container< bool >.
virtual bool& PLCore::Bitset::Add | ( | const bool & | Element | ) | [override, virtual] |
Appends an element to the container.
Implements PLCore::Container< bool >.
virtual uint32 PLCore::Bitset::Add | ( | const bool * | pElements, |
uint32 | nCount | ||
) | [override, virtual] |
Adds elements from a given C-array.
[in] | pElements | Pointer to C-array with the elements to add, if a null pointer, nothing is done |
[in] | nCount | Number of elements to add, the given C-array MUST have at least nCount elements! |
Implements PLCore::Container< bool >.
Container< bool > & PLCore::Bitset::operator+= | ( | const bool & | Element | ) | [inline, virtual] |
virtual bool PLCore::Bitset::Add | ( | const Container< bool > & | lstContainer, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) | [override, virtual] |
Appends an container to this container.
[in] | lstContainer | Container to add |
[in] | nStart | Index the copy operation should start |
[in] | nCount | Number of elements to copy, if 0 copy all elements of lstContainer behind nStart |
Implements PLCore::Container< bool >.
Container< bool > & PLCore::Bitset::operator+= | ( | const Container< bool > & | lstContainer | ) | [inline, virtual] |
Appends an container to this container.
[in] | lstContainer | Container to add |
Implements PLCore::Container< bool >.
virtual bool& PLCore::Bitset::AddAtIndex | ( | int | nIndex | ) | [override, virtual] |
Appends an element to the container at the given index.
[in] | nIndex | Index were to add the new element, if < 0 add at end, must be <= 'GetNumOfElements()' |
Implements PLCore::Container< bool >.
virtual bool& PLCore::Bitset::AddAtIndex | ( | const bool & | Element, |
int | nIndex | ||
) | [override, virtual] |
Appends an element to the container at the given index.
[in] | Element | Element to add |
[in] | nIndex | Index were to add the new element, if < 0 add at end, must be <= 'GetNumOfElements()' |
Implements PLCore::Container< bool >.
bool PLCore::Bitset::Remove | ( | const bool & | Element | ) | [inline, virtual] |
Removes an element (first appearance) from the container.
Implements PLCore::Container< bool >.
virtual bool PLCore::Bitset::RemoveAtIndex | ( | uint32 | nElement | ) | [override, virtual] |
Removes the element at the given index from the container.
[in] | nElement | Index of the element to remove |
Implements PLCore::Container< bool >.
Container< bool > & PLCore::Bitset::operator-= | ( | const bool & | Element | ) | [inline, virtual] |
virtual bool PLCore::Bitset::Remove | ( | const Container< bool > & | lstContainer, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) | [override, virtual] |
Removes the elements of an container from this container.
[in] | lstContainer | Container to remove the elements from this container |
[in] | nStart | Index the remove operation should start |
[in] | nCount | Number of elements to remove, if 0 remove all elements of lstContainer behind nStart |
Implements PLCore::Container< bool >.
Container< bool > & PLCore::Bitset::operator-= | ( | const Container< bool > & | lstContainer | ) | [inline, virtual] |
Removes the elements of an container from this container.
[in] | lstContainer | Container to remove the elements from this container |
Implements PLCore::Container< bool >.
virtual bool PLCore::Bitset::Copy | ( | const Container< bool > & | lstContainer, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) | [override, virtual] |
Makes this container to a copy of another container.
[in] | lstContainer | Container to copy from |
[in] | nStart | Index the copy operation should start |
[in] | nCount | Number of elements to copy, if 0 copy all elements of lstContainer behind nStart |
Implements PLCore::Container< bool >.
Container< bool > & PLCore::Bitset::operator= | ( | const Container< bool > & | lstContainer | ) | [inline, virtual] |
Makes this container to a copy of another container.
[in] | lstContainer | Container to copy from |
Implements PLCore::Container< bool >.
virtual bool PLCore::Bitset::Compare | ( | const Container< bool > & | lstContainer, |
uint32 | nStart = 0 , |
||
uint32 | nCount = 0 |
||
) | const [override, virtual] |
Compares two containers.
[in] | lstContainer | Container to compare with |
[in] | nStart | Index the compare operation should start |
[in] | nCount | Number of elements to compare, if 0 compare all elements of lstContainer behind nStart |
Implements PLCore::Container< bool >.
bool PLCore::Bitset::operator== | ( | const Container< bool > & | lstContainer | ) | const [inline, virtual] |
Compares two containers.
[in] | lstContainer | Container to compare with |
Implements PLCore::Container< bool >.
bool PLCore::Bitset::operator!= | ( | const Container< bool > & | lstContainer | ) | const [inline, virtual] |
Compares two containers.
[in] | lstContainer | Container to compare with |
Implements PLCore::Container< bool >.
|