PhoenixGraph  01.0.0
Set of tools to simplify graph manipulation
Loading...
Searching...
No Matches
Node< T, UIdx > Class Template Reference

Node of a Graph. More...

#include <Node.h>

Public Member Functions

void addChild (UIdx child)
 Add a child to the current Node.
 
void addParent (UIdx parent)
 Add a parent to the current Node.
 
T & getData ()
 Get the data of the Node.
 
const T & getData () const
 Get the data of the Node.
 
std::string getDotDefinition () const
 Get the dot definition name of the current Node.
 
std::string getDotName () const
 Get the dot name of the current Node.
 
UIdx getIndex () const
 Get the index of the Node.
 
bool & getIsUpdated ()
 Say if the node is updated.
 
bool getIsUpdated () const
 Say if the node is updated.
 
std::list< UIdx > & getListChild ()
 Get the list of children of the Node.
 
const std::list< UIdx > & getListChild () const
 Get the list of children of the Node.
 
std::list< UIdx > & getListParent ()
 Get the list of parents of the Node.
 
const std::list< UIdx > & getListParent () const
 Get the list of parents of the Node.
 
std::string & getName ()
 Get the name of the Node.
 
const std::string & getName () const
 Get the name of the Node.
 
bool isEnd () const
 Say if the current Node has no child.
 
bool isStart () const
 Say if the current Node has no parent.
 
 Node (const Node< T, UIdx > &other)
 Copy constructor of Node.
 
 Node (const std::string &name="")
 Default constructor of Node.
 
 Node (const T &data, const std::string &name="")
 Constructor of Node.
 
Nodeoperator= (const Node< T, UIdx > &other)
 Definition of equal operator of Node.
 
void removeChild (UIdx child)
 Remove connection with child.
 
void removeParent (UIdx parent)
 Remove connection with parent.
 
void setData (const T &data)
 Set the data of the Node.
 
void setIndex (UIdx index)
 Set the index of the Node.
 
void setIsUpdated (bool isUpdated)
 Say if the node is updated.
 
void setListChild (const std::list< UIdx > &listChild)
 Set the list of children of the Node.
 
void setListParent (const std::list< UIdx > &listParent)
 Set the list of parents of the Node.
 
void setName (const std::string &name)
 Set the name of the Node.
 
virtual ~Node ()
 Destructor of Node.
 

Protected Member Functions

void copyNode (const Node< T, UIdx > &other)
 Copy function of Node.
 

Private Member Functions

void initialisationNode ()
 Initialisation function of the class Node.
 

Private Attributes

p_data
 Data of the node.
 
UIdx p_index
 Index of the current Node.
 
bool p_isUpdated
 Check if the current Node has been already updated.
 
std::list< UIdx > p_listChild
 List of children Node.
 
std::list< UIdx > p_listParent
 List of parent Node.
 
std::string p_name
 Name of the current Node.
 

Detailed Description

template<typename T, typename UIdx>
class Node< T, UIdx >

Node of a Graph.

T : type of the data to be connected in the graph UIdx : type of the index to be used to connect the Node together

Definition at line 17 of file Node.h.

Constructor & Destructor Documentation

◆ Node() [1/3]

template<typename T, typename UIdx>
Node< T, UIdx >::Node ( const std::string & name = "")

Default constructor of Node.

Parameters
name: name of th current Node

Definition at line 41 of file Node_impl.h.

41 {
43 p_name = name;
44}
Node of a Graph.
Definition Node.h:17
std::string p_name
Name of the current Node.
Definition Node.h:69
void initialisationNode()
Initialisation function of the class Node.
Definition Node_impl.h:274

References initialisationNode(), and p_name.

Referenced by copyNode(), Node(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Node() [2/3]

template<typename T, typename UIdx>
Node< T, UIdx >::Node ( const T & data,
const std::string & name = "" )

Constructor of Node.

Parameters
data: data of the current Node
name: name of th current Node

Definition at line 50 of file Node_impl.h.

50 {
52 p_name = name;
53 p_data = data;
54}
T p_data
Data of the node.
Definition Node.h:73

References initialisationNode(), p_data, and p_name.

+ Here is the call graph for this function:

◆ Node() [3/3]

template<typename T, typename UIdx>
Node< T, UIdx >::Node ( const Node< T, UIdx > & other)

Copy constructor of Node.

Parameters
other: class to copy

Definition at line 60 of file Node_impl.h.

60 {
62}
void copyNode(const Node< T, UIdx > &other)
Copy function of Node.
Definition Node_impl.h:263

References copyNode(), and Node().

+ Here is the call graph for this function:

◆ ~Node()

template<typename T, typename UIdx>
Node< T, UIdx >::~Node ( )
virtual

Destructor of Node.

Definition at line 66 of file Node_impl.h.

66 {
67
68}

Member Function Documentation

◆ addChild()

template<typename T, typename UIdx>
void Node< T, UIdx >::addChild ( UIdx child)

Add a child to the current Node.

Parameters
child: index of the corresponding child Node

Definition at line 84 of file Node_impl.h.

84 {
85 p_listChild.push_back(child);
86}
std::list< UIdx > p_listChild
List of children Node.
Definition Node.h:63

References p_listChild.

Referenced by Graph< T, UIdx >::connectNode(), Graph< T, UIdx >::connectNode(), and Graph< T, UIdx >::connectNode().

+ Here is the caller graph for this function:

◆ addParent()

template<typename T, typename UIdx>
void Node< T, UIdx >::addParent ( UIdx parent)

Add a parent to the current Node.

Parameters
parent: index of the corresponding parent Node

Definition at line 92 of file Node_impl.h.

92 {
93 p_listParent.push_back(parent);
94}
std::list< UIdx > p_listParent
List of parent Node.
Definition Node.h:65

References p_listParent.

Referenced by Graph< T, UIdx >::connectNode(), Graph< T, UIdx >::connectNode(), and Graph< T, UIdx >::connectNode().

+ Here is the caller graph for this function:

◆ copyNode()

template<typename T, typename UIdx>
void Node< T, UIdx >::copyNode ( const Node< T, UIdx > & other)
protected

Copy function of Node.

Parameters
other: class to copy

Definition at line 263 of file Node_impl.h.

263 {
270}
bool p_isUpdated
Check if the current Node has been already updated.
Definition Node.h:71
UIdx p_index
Index of the current Node.
Definition Node.h:67

References Node(), p_data, p_index, p_isUpdated, p_listChild, p_listParent, and p_name.

Referenced by Node(), and operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getData() [1/2]

template<typename T, typename UIdx>
T & Node< T, UIdx >::getData ( )

Get the data of the Node.

Returns
data of the Node

Definition at line 212 of file Node_impl.h.

212{return p_data;}

References p_data.

◆ getData() [2/2]

template<typename T, typename UIdx>
const T & Node< T, UIdx >::getData ( ) const

Get the data of the Node.

Returns
data of the Node

Definition at line 206 of file Node_impl.h.

206{return p_data;}

References p_data.

◆ getDotDefinition()

template<typename T, typename UIdx>
std::string Node< T, UIdx >::getDotDefinition ( ) const

Get the dot definition name of the current Node.

Returns
dot definition name of the current Node

Definition at line 241 of file Node_impl.h.

241 {
242 std::string body("");
244 if(strName == ""){
246 }
247 body += "\t" + getDotName() + "[label=\"" + strName + "\"][color=\"blue\"]";
248 if(isStart()){
249 body += "[shape=octagon]";
250 }else if(isEnd()){
251 body += "[shape=cylinder]";
252 }else{
253 body += "[shape=record]";
254 }
255 body += ";\n";
256 return body;
257}
std::string node_convertToString(const T &val)
Convert a type into a string.
Definition Node_impl.h:19
std::string getDotName() const
Get the dot name of the current Node.
Definition Node_impl.h:230
bool isEnd() const
Say if the current Node has no child.
Definition Node_impl.h:224
bool isStart() const
Say if the current Node has no parent.
Definition Node_impl.h:218

References getDotName(), isEnd(), isStart(), node_convertToString(), p_index, and p_name.

+ Here is the call graph for this function:

◆ getDotName()

template<typename T, typename UIdx>
std::string Node< T, UIdx >::getDotName ( ) const

Get the dot name of the current Node.

Returns
dot name of the current Node

Definition at line 230 of file Node_impl.h.

230 {
231 std::string body("");
232 body += "node";
234 return body;
235}

References node_convertToString(), and p_index.

Referenced by getDotDefinition(), and Graph< T, UIdx >::toDot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIndex()

template<typename T, typename UIdx>
UIdx Node< T, UIdx >::getIndex ( ) const

Get the index of the Node.

Returns
index of the Node

Definition at line 176 of file Node_impl.h.

176{return p_index;}

References p_index.

◆ getIsUpdated() [1/2]

template<typename T, typename UIdx>
bool & Node< T, UIdx >::getIsUpdated ( )

Say if the node is updated.

Returns
true if the Node is updated, false otherwise

Definition at line 200 of file Node_impl.h.

200{return p_isUpdated;}

References p_isUpdated.

◆ getIsUpdated() [2/2]

template<typename T, typename UIdx>
bool Node< T, UIdx >::getIsUpdated ( ) const

Say if the node is updated.

Returns
true if the Node is updated, false otherwise

Definition at line 194 of file Node_impl.h.

194{return p_isUpdated;}

References p_isUpdated.

Referenced by Graph< T, UIdx >::isListNodeUdpated(), Graph< T, UIdx >::iterateChildrenCheckUpdate(), and Graph< T, UIdx >::iterateParentCheckUpdate().

+ Here is the caller graph for this function:

◆ getListChild() [1/2]

template<typename T, typename UIdx>
std::list< UIdx > & Node< T, UIdx >::getListChild ( )

Get the list of children of the Node.

Returns
list of children of the Node

Definition at line 158 of file Node_impl.h.

158{return p_listChild;}

References p_listChild.

◆ getListChild() [2/2]

template<typename T, typename UIdx>
const std::list< UIdx > & Node< T, UIdx >::getListChild ( ) const

Get the list of children of the Node.

Returns
list of children of the Node

Definition at line 152 of file Node_impl.h.

152{return p_listChild;}

References p_listChild.

Referenced by Graph< T, UIdx >::iterateChildren(), Graph< T, UIdx >::iterateChildrenCheckUpdate(), Graph< T, UIdx >::iterateParentCheckUpdate(), and Graph< T, UIdx >::removeNode().

+ Here is the caller graph for this function:

◆ getListParent() [1/2]

template<typename T, typename UIdx>
std::list< UIdx > & Node< T, UIdx >::getListParent ( )

Get the list of parents of the Node.

Returns
list of parents of the Node

Definition at line 170 of file Node_impl.h.

170{return p_listParent;}

References p_listParent.

◆ getListParent() [2/2]

template<typename T, typename UIdx>
const std::list< UIdx > & Node< T, UIdx >::getListParent ( ) const

Get the list of parents of the Node.

Returns
list of parents of the Node

Definition at line 164 of file Node_impl.h.

164{return p_listParent;}

References p_listParent.

Referenced by Graph< T, UIdx >::iterateChildrenCheckUpdate(), Graph< T, UIdx >::iterateParent(), Graph< T, UIdx >::iterateParentCheckUpdate(), and Graph< T, UIdx >::removeNode().

+ Here is the caller graph for this function:

◆ getName() [1/2]

template<typename T, typename UIdx>
std::string & Node< T, UIdx >::getName ( )

Get the name of the Node.

Returns
name of the Node

Definition at line 188 of file Node_impl.h.

188{return p_name;}

References p_name.

◆ getName() [2/2]

template<typename T, typename UIdx>
const std::string & Node< T, UIdx >::getName ( ) const

Get the name of the Node.

Returns
name of the Node

Definition at line 182 of file Node_impl.h.

182{return p_name;}

References p_name.

◆ initialisationNode()

template<typename T, typename UIdx>
void Node< T, UIdx >::initialisationNode ( )
private

Initialisation function of the class Node.

Definition at line 274 of file Node_impl.h.

274 {
275 p_name = "";
276 p_isUpdated = false;
277}

References p_isUpdated, and p_name.

Referenced by Node(), and Node().

+ Here is the caller graph for this function:

◆ isEnd()

template<typename T, typename UIdx>
bool Node< T, UIdx >::isEnd ( ) const

Say if the current Node has no child.

Returns
true if the current Node has no child, false otherwise

Definition at line 224 of file Node_impl.h.

224{return p_listChild.size() == 0lu;}

References p_listChild.

Referenced by getDotDefinition().

+ Here is the caller graph for this function:

◆ isStart()

template<typename T, typename UIdx>
bool Node< T, UIdx >::isStart ( ) const

Say if the current Node has no parent.

Returns
true if the current Node has no parent, false otherwise

Definition at line 218 of file Node_impl.h.

218{return p_listParent.size() == 0lu;}

References p_listParent.

Referenced by getDotDefinition().

+ Here is the caller graph for this function:

◆ operator=()

template<typename T, typename UIdx>
Node< T, UIdx > & Node< T, UIdx >::operator= ( const Node< T, UIdx > & other)

Definition of equal operator of Node.

Parameters
other: class to copy
Returns
copied class

Definition at line 75 of file Node_impl.h.

75 {
77 return *this;
78}

References copyNode(), and Node().

+ Here is the call graph for this function:

◆ removeChild()

template<typename T, typename UIdx>
void Node< T, UIdx >::removeChild ( UIdx child)

Remove connection with child.

Parameters
child: index of the child to be removed

Definition at line 100 of file Node_impl.h.

100 {
102}
void listindex_remove(std::list< UIdx > &listIndex, UIdx index)
Remove index from listIndex.

References listindex_remove(), and p_listChild.

Referenced by Graph< T, UIdx >::removeNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeParent()

template<typename T, typename UIdx>
void Node< T, UIdx >::removeParent ( UIdx parent)

Remove connection with parent.

Parameters
parent: index of the parent to be removed

Definition at line 108 of file Node_impl.h.

References listindex_remove(), and p_listParent.

Referenced by Graph< T, UIdx >::removeNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setData()

template<typename T, typename UIdx>
void Node< T, UIdx >::setData ( const T & data)

Set the data of the Node.

Parameters
data: data of the Node

Definition at line 146 of file Node_impl.h.

146{p_data = data;}

References p_data.

◆ setIndex()

template<typename T, typename UIdx>
void Node< T, UIdx >::setIndex ( UIdx index)

Set the index of the Node.

Parameters
index: index of the Node

Definition at line 128 of file Node_impl.h.

128{p_index = index;}

References p_index.

Referenced by Graph< T, UIdx >::createNode(), and Graph< T, UIdx >::createNode().

+ Here is the caller graph for this function:

◆ setIsUpdated()

template<typename T, typename UIdx>
void Node< T, UIdx >::setIsUpdated ( bool isUpdated)

Say if the node is updated.

Parameters
isUpdated: true if the Node is updated, false otherwise

Definition at line 140 of file Node_impl.h.

References p_isUpdated.

Referenced by Graph< T, UIdx >::iterateChildrenCheckUpdate(), and Graph< T, UIdx >::iterateParentCheckUpdate().

+ Here is the caller graph for this function:

◆ setListChild()

template<typename T, typename UIdx>
void Node< T, UIdx >::setListChild ( const std::list< UIdx > & listChild)

Set the list of children of the Node.

Parameters
listChild: list of children of the Node

Definition at line 116 of file Node_impl.h.

References p_listChild.

◆ setListParent()

template<typename T, typename UIdx>
void Node< T, UIdx >::setListParent ( const std::list< UIdx > & listParent)

Set the list of parents of the Node.

Parameters
listParent: list of parents of the Node

Definition at line 122 of file Node_impl.h.

References p_listParent.

◆ setName()

template<typename T, typename UIdx>
void Node< T, UIdx >::setName ( const std::string & name)

Set the name of the Node.

Parameters
name: name of the Node

Definition at line 134 of file Node_impl.h.

134{p_name = name;}

References p_name.

Member Data Documentation

◆ p_data

template<typename T, typename UIdx>
T Node< T, UIdx >::p_data
private

Data of the node.

Definition at line 73 of file Node.h.

Referenced by copyNode(), getData(), getData(), Node(), and setData().

◆ p_index

template<typename T, typename UIdx>
UIdx Node< T, UIdx >::p_index
private

Index of the current Node.

Definition at line 67 of file Node.h.

Referenced by copyNode(), getDotDefinition(), getDotName(), getIndex(), and setIndex().

◆ p_isUpdated

template<typename T, typename UIdx>
bool Node< T, UIdx >::p_isUpdated
private

Check if the current Node has been already updated.

Definition at line 71 of file Node.h.

Referenced by copyNode(), getIsUpdated(), getIsUpdated(), initialisationNode(), and setIsUpdated().

◆ p_listChild

template<typename T, typename UIdx>
std::list<UIdx> Node< T, UIdx >::p_listChild
private

List of children Node.

Definition at line 63 of file Node.h.

Referenced by addChild(), copyNode(), getListChild(), getListChild(), isEnd(), removeChild(), and setListChild().

◆ p_listParent

template<typename T, typename UIdx>
std::list<UIdx> Node< T, UIdx >::p_listParent
private

List of parent Node.

Definition at line 65 of file Node.h.

Referenced by addParent(), copyNode(), getListParent(), getListParent(), isStart(), removeParent(), and setListParent().

◆ p_name

template<typename T, typename UIdx>
std::string Node< T, UIdx >::p_name
private

Name of the current Node.

Definition at line 69 of file Node.h.

Referenced by copyNode(), getDotDefinition(), getName(), getName(), initialisationNode(), Node(), Node(), and setName().


The documentation for this class was generated from the following files: