| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #ifndef __NODE_H__ | ||
| 8 | #define __NODE_H__ | ||
| 9 | |||
| 10 | #include "list_index_utils.h" | ||
| 11 | |||
| 12 | ///@brief Node of a Graph | ||
| 13 | /** T : type of the data to be connected in the graph | ||
| 14 | * UIdx : type of the index to be used to connect the Node together | ||
| 15 | */ | ||
| 16 | template<typename T, typename UIdx> | ||
| 17 | class Node{ | ||
| 18 | public: | ||
| 19 |
1/1✓ Branch 0 (7→8) taken 26 times.
|
78 | Node(const std::string & name = ""); |
| 20 | Node(const T & data, const std::string & name = ""); | ||
| 21 | Node(const Node<T, UIdx> & other); | ||
| 22 | virtual ~Node(); | ||
| 23 | Node & operator = (const Node<T, UIdx> & other); | ||
| 24 | |||
| 25 | void addChild(UIdx child); | ||
| 26 | void addParent(UIdx parent); | ||
| 27 | |||
| 28 | void removeChild(UIdx child); | ||
| 29 | void removeParent(UIdx parent); | ||
| 30 | |||
| 31 | void setListChild(const std::list<UIdx> & listChild); | ||
| 32 | void setListParent(const std::list<UIdx> & listParent); | ||
| 33 | void setIndex(UIdx index); | ||
| 34 | void setName(const std::string & name); | ||
| 35 | void setIsUpdated(bool isUpdated); | ||
| 36 | void setData(const T & data); | ||
| 37 | |||
| 38 | const std::list<UIdx> & getListChild() const; | ||
| 39 | std::list<UIdx> & getListChild(); | ||
| 40 | const std::list<UIdx> & getListParent() const; | ||
| 41 | std::list<UIdx> & getListParent(); | ||
| 42 | UIdx getIndex() const; | ||
| 43 | const std::string & getName() const; | ||
| 44 | std::string & getName(); | ||
| 45 | bool getIsUpdated() const; | ||
| 46 | bool & getIsUpdated(); | ||
| 47 | const T & getData() const; | ||
| 48 | T & getData(); | ||
| 49 | |||
| 50 | bool isStart() const; | ||
| 51 | bool isEnd() const; | ||
| 52 | |||
| 53 | std::string getDotName() const; | ||
| 54 | std::string getDotDefinition() const; | ||
| 55 | |||
| 56 | protected: | ||
| 57 | void copyNode(const Node<T, UIdx> & other); | ||
| 58 | |||
| 59 | private: | ||
| 60 | void initialisationNode(); | ||
| 61 | |||
| 62 | ///List of children Node | ||
| 63 | std::list<UIdx> p_listChild; | ||
| 64 | ///List of parent Node | ||
| 65 | std::list<UIdx> p_listParent; | ||
| 66 | ///Index of the current Node | ||
| 67 | UIdx p_index; | ||
| 68 | ///Name of the current Node | ||
| 69 | std::string p_name; | ||
| 70 | ///Check if the current Node has been already updated | ||
| 71 | bool p_isUpdated; | ||
| 72 | ///Data of the node | ||
| 73 | T p_data; | ||
| 74 | }; | ||
| 75 | |||
| 76 | #include "Node_impl.h" | ||
| 77 | |||
| 78 | |||
| 79 | #endif | ||
| 80 | |||
| 81 |