concepts::Joiner< T, nlnk > Class Template Reference
Joiner class with multiple successors, i.e. More...
#include <scannerConnectors.hh>
Public Member Functions | |
Joiner (const T &val, Joiner *lnk=0) | |
Constructor. More... | |
Joiner *& | operator[] (uint i) |
Index operator for the container. More... | |
T & | value () |
Returns the content of the container. More... | |
~Joiner () | |
Empty destructor. More... | |
Static Public Member Functions | |
static void | destructor (Joiner< T, nlnk > *&j, bool values=true) |
Static function to delete the list/tree. More... | |
Private Member Functions | |
Joiner (const Joiner &) | |
Copy constructor. More... | |
void | operator= (const Joiner &) |
Static Private Member Functions | |
static void | destructor_ (Joiner< T, nlnk > *j, bool values=true) |
Recursive destructor. More... | |
Private Attributes | |
Joiner< T, nlnk > * | lnk_ [nlnk] |
Array of the successors. More... | |
T | val_ |
The content of the container. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Joiner< T, nlnk > &j) |
Detailed Description
template<class T, unsigned nlnk>
class concepts::Joiner< T, nlnk >
Joiner class with multiple successors, i.e.
it can represent a b-ary tree with b=nlnk. A Joiner is a node in this tree. with b=1 the tree degraded to a forward linked list.
Adding a new node at the beginning of the list is as easy as
Joiner<int, 1>* list; int a = 2; list = new Joiner<int, 1>(a, list);
It is not possible to use unique_ptr and Joiner together in a construction like
unique_ptr<Joiner<int, 1> > list;
though. The assignment operator = of unique_ptr releases (ie. deletes) the old object when a new object is assigned. In the statement above, the list on the right hand side would be deleted...
- Note
- this class would more probably be called BAryTreeNode
- Parameters
-
T Class to be stored nlnk Number of successors (ie. links)
Definition at line 47 of file scannerConnectors.hh.
Constructor & Destructor Documentation
◆ Joiner() [1/2]
|
inline |
Constructor.
Fills the container and sets the successors to default of NULL. If a successor is given as argument its filled in as the last successor.
- Parameters
-
val Content of the container. lnk Initialization value for the last successor.
Definition at line 125 of file scannerConnectors.hh.
◆ ~Joiner()
|
inline |
Empty destructor.
To delete the list/tree do it by hand or use destructor (only if T pointer).
Definition at line 88 of file scannerConnectors.hh.
◆ Joiner() [2/2]
|
private |
Copy constructor.
Member Function Documentation
◆ destructor()
|
static |
Static function to delete the list/tree.
This Function is only valid if T is a pointer type allocated with new().
- Parameters
-
j Root of the list/tree. It is overwritten with 0
Definition at line 135 of file scannerConnectors.hh.
◆ destructor_()
|
staticprivate |
Recursive destructor.
Definition at line 152 of file scannerConnectors.hh.
◆ operator=()
|
private |
◆ operator[]()
|
inline |
Index operator for the container.
- Precondition
- i < nlnk
- Returns
- The ith successor.
Definition at line 101 of file scannerConnectors.hh.
◆ value()
|
inline |
Returns the content of the container.
Definition at line 107 of file scannerConnectors.hh.
Friends And Related Function Documentation
◆ operator<<
|
friend |
Definition at line 161 of file scannerConnectors.hh.
Member Data Documentation
◆ lnk_
|
private |
Array of the successors.
Definition at line 111 of file scannerConnectors.hh.
◆ val_
|
private |
The content of the container.
Definition at line 114 of file scannerConnectors.hh.
The documentation for this class was generated from the following file:
- toolbox/scannerConnectors.hh