Boolean Vector Cursor. More...

#include <rboolcursor.h>

Public Member Functions

 RBoolCursor (void)
 
 RBoolCursor (const RBoolCursor &cur)
 
 RBoolCursor (const RBoolVector &vector, size_t min=0, size_t max=SIZE_MAX)
 
void Set (const RBoolVector &vector, size_t min=0, size_t max=SIZE_MAX)
 
size_t GetNb (void) const
 
void Start (void)
 
void StartFromEnd (void)
 
bool End (void) const
 
bool Begin (void) const
 
void GoTo (size_t idx)
 
void Next (size_t inc=1)
 
void Prev (size_t inc=1)
 
bool operator() (void) const
 
bool & operator() (void)
 
size_t GetPos (void) const
 

Private Attributes

size_t NbBool
 
bool * List
 
bool * Parse
 
size_t Pos
 
size_t First
 
size_t Last
 

Detailed Description

Boolean Vector Cursor.

The RBoolCursor class provides a cursor over a vector of boolean values.

RBoolVector a(3);
a[0]=1.0;
a[1]=2.0;
a[2]=3.0;
RBoolCursor Cur(a);
for(Cur.Start();!Cur.End();Cur.Next())
cout<<Cur()<<endl;

Constructor & Destructor Documentation

RBoolCursor ( void  )

Construct a null cursor.

RBoolCursor ( const RBoolCursor cur)

Copy constructor.

Parameters
curCursor to copy.
RBoolCursor ( const RBoolVector vector,
size_t  min = 0,
size_t  max = SIZE_MAX 
)

Construct a cursor over a given vector.

Parameters
vectorVector.
minMinimum position of the elements to iterate.
maxMaximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.

Member Function Documentation

void Set ( const RBoolVector vector,
size_t  min = 0,
size_t  max = SIZE_MAX 
)

Set a cursor to a given vector.

Parameters
vectorVector.
minMinimum position of the elements to iterate.
maxMaximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.
size_t GetNb ( void  ) const

Get the number of values in the list.

Returns
size_t
void Start ( void  )

Start the iterator to go trough the vector.

void StartFromEnd ( void  )

Start the iterator at the end of the vector.

bool End ( void  ) const

Test if the end of the vector is reached.

bool Begin ( void  ) const

Test if the begin of the vector is reached.

void GoTo ( size_t  idx)

Go to the i-th position of the cursor.

Parameters
idxIndex of the element to get.
void Next ( size_t  inc = 1)

Go to a given number of next elements. If the end is reached, go to the beginning.

Parameters
incNumber of elements to go to.
void Prev ( size_t  inc = 1)

Go to a given number of previous elements. If the begin is reached, go to the end.

Parameters
incNumber of elements to go to.
bool operator() ( void  ) const

Return the current element (const version).

bool& operator() ( void  )

Return the current element.

size_t GetPos ( void  ) const

Return the actual position in the cursor.

Field Documentation

size_t NbBool
private

Number of values in the vector.

bool* List
private

The array representing the values.

bool* Parse
private

Pointer used to parse the vector.

size_t Pos
private

Current position parsed.

size_t First
private

The first position in the array handled by the cursor.

size_t Last
private

The last position in the array handled by the cursor.