Boolean Vector. More...
#include <rboolvector.h>
Public Member Functions | |
RBoolVector (size_t nb, bool val=false) | |
RBoolVector (const RBoolVector &vec) | |
bool | GetDefault (void) const |
void | SetDefault (bool val) |
void | ReSize (size_t size) |
void | Init (size_t nb, bool val) |
bool | IsSame (const RBoolVector &vector) const |
void | Set (bool value, size_t pos) |
void | Clear (void) |
RBoolVector & | operator= (const RBoolVector &src) |
bool | operator[] (size_t i) const |
bool & | operator[] (size_t i) |
const bool * | GetList (void) const |
size_t | GetNb (void) const |
size_t | GetMax (void) const |
virtual | ~RBoolVector (void) |
Private Member Functions | |
void | Verify (size_t max) |
Private Attributes | |
size_t | NbBool |
size_t | MaxBool |
bool * | List |
bool | Default |
Detailed Description
Boolean Vector.
The RBoolVector class provides a representation of a vector of boolean values. A default value (that can be modified) is assigned to new elements.
Constructor & Destructor Documentation
RBoolVector | ( | size_t | nb, |
bool | val = false |
||
) |
Construct the vector of boolean values.
- Parameters
-
nb Number of values. val Default value.
RBoolVector | ( | const RBoolVector & | vec | ) |
Copy constructor.
- Parameters
-
vec Vector to copy.
|
virtual |
Destruct the vector.
Member Function Documentation
bool GetDefault | ( | void | ) | const |
Get the default value.
void SetDefault | ( | bool | val | ) |
Set the default value that will be used for the new elements created in the future.
- Parameters
-
val Default value.
|
private |
Verify if the vector can hold a certain number of elements. If necessary, the vector is extended with undefined values.
- Parameters
-
max Number of elements in the vector.
void ReSize | ( | size_t | size | ) |
Resize the vector. If necessary, the vector is extended and new elements are set to the default value.
- Parameters
-
size Number of elements in the vector.
void Init | ( | size_t | nb, |
bool | val | ||
) |
Initialize the first element of the vector with a given values. If necessary, the vector is extended.
- Parameters
-
nb Number of elements. val Value used to initialize.
bool IsSame | ( | const RBoolVector & | vector | ) | const |
Test if two vectors have exactly the same values.
- Parameters
-
vector Vector used for the comparison.
- Returns
- True if the lists are the same.
void Set | ( | bool | value, |
size_t | pos | ||
) |
Set the boolean value at a given position. If necessary, the vector is extended and the new elements receive the default value.
- Parameters
-
value Value to insert. pos The position where to insert.
void Clear | ( | void | ) |
Clear the vector (set all values to the default value).
RBoolVector& operator= | ( | const RBoolVector & | src | ) |
Assignment operator.
- Parameters
-
src List used for the assignment.
bool operator[] | ( | size_t | i | ) | const |
Return the boolean value at position i. The first boolean value is at position 0 (const version).
- Parameters
-
i Index.
bool& operator[] | ( | size_t | i | ) |
Return the boolean value at position i. The first boolean value is at position 0.
- Parameters
-
i Index.
const bool* GetList | ( | void | ) | const |
Get the list of the booleans contained in the vector.
size_t GetNb | ( | void | ) | const |
Get the number of values in the vector.
- Returns
- size_t
size_t GetMax | ( | void | ) | const |
Get the actual maximal number of values in the vector.
- Returns
- size_t
Field Documentation
|
private |
Number of values in the vector.
|
private |
Maximal number of values in the vector.
|
private |
The array representing the boolean values.
|
private |
Default value.