Node Cursor. More...
#include <rtree.h>
Public Member Functions | |
RNodeCursor (void) | |
RNodeCursor (const RNodeCursor< T, N > &src) | |
RNodeCursor (const N *node, size_t min=0, size_t max=SIZE_MAX) | |
RNodeCursor (const T &root, size_t min=0, size_t max=SIZE_MAX) | |
RNodeCursor< T, N > & | operator= (const RNodeCursor< T, N > &src) |
void | Set (const T &root, size_t min=0, size_t max=SIZE_MAX) |
void | Set (const N *node, size_t min=0, size_t max=SIZE_MAX) |
void | Clear (void) |
void | Start (void) |
void | StartFromEnd (void) |
void | GoTo (size_t idx) |
size_t | GetPos (void) const |
size_t | GetMaxPos (void) const |
size_t | GetNb (void) const |
bool | Begin (void) const |
bool | End (void) const |
bool | IsAt (size_t idx) const |
void | Next (size_t inc=1) |
void | Prev (size_t inc=1) |
N * | operator() (void) const |
Protected Attributes | |
const T * | Root |
const N * | Node |
N * | Current |
size_t | ActPtr |
size_t | NbPtr |
size_t | FirstPtr |
size_t | LastPtr |
Detailed Description
template<class T, class N>
singleton R::RNodeCursor< T, N >
Node Cursor.
This class represent a cursor iterating childs of a given RNode of a RTree.
- Parameters
-
T Class of the tree. N Class of the node.
- Attention
- When an element is added or removed from the node parsed by the cursor, the cursor is not valid anymore.
Here is an example of a cursor used:
Constructor & Destructor Documentation
RNodeCursor | ( | void | ) |
Construct the cursor.
RNodeCursor | ( | const RNodeCursor< T, N > & | src | ) |
Construct the cursor.
- Parameters
-
src Source container.
RNodeCursor | ( | const N * | node, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Construct the cursor.
- Parameters
-
node Node to iterate. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SIZE_MAX, iterate until the end of the container.
RNodeCursor | ( | const T & | root, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Construct the cursor.
- Parameters
-
root Root node to iterate. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SIZE_MAX, iterate until the end of the container.
Member Function Documentation
RNodeCursor<T,N>& operator= | ( | const RNodeCursor< T, N > & | src | ) |
Assignment operator using a "Cursor".
- Parameters
-
src Source container.
void Set | ( | const T & | root, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Set the container.
- Parameters
-
root Top node to iterate. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.
void Set | ( | const N * | node, |
size_t | min = 0 , |
||
size_t | max = SIZE_MAX |
||
) |
Set the container.
- Parameters
-
node Node to iterate. min Minimum position of the elements to iterate. max Maximum position of the elements to iterate (included max). If SZE_MAX, iterate until the end of the container.
void Clear | ( | void | ) |
Clear the cursor.
void Start | ( | void | ) |
Start the iterator at the beginning of the container.
void StartFromEnd | ( | void | ) |
Start the iterator at the end of the container.
void GoTo | ( | size_t | idx | ) |
Go to the i-th element of the cursor.
- Parameters
-
idx Index of the element to get.
size_t GetPos | ( | void | ) | const |
Return the actual position in the cursor.
size_t GetMaxPos | ( | void | ) | const |
- Returns
- the maximal position occupied by an elements in the container.
size_t GetNb | ( | void | ) | const |
Return the number of elements in the cursor.
bool Begin | ( | void | ) | const |
Test if the begin of the cursor is reached.
bool End | ( | void | ) | const |
Test if the end of the cursor is reached.
bool IsAt | ( | size_t | idx | ) | const |
Test if the cursor is at a given index.
- Parameters
-
idx Index of the element.
void Next | ( | size_t | inc = 1 | ) |
Go to a given number of next elements. If the end is reached, go to the beginning.
- Parameters
-
inc Number 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
-
inc Number of elements to go to.
N* operator() | ( | void | ) | const |
- Returns
- the current element.
Field Documentation
|
protected |
Root node iterated;
|
protected |
Node iterated;
|
protected |
This variable is used to go through the node.
|
protected |
This variable is used to see if the end of the node is reached.
|
protected |
The number of elements in the node.
|
protected |
The first position handled by the cursor.
|
protected |
The last position handled by the cursor.