21 #ifndef OTAWA_TSIM_TREEPATH_H
22 #define OTAWA_TSIM_TREEPATH_H
23 #include <elm/util/Option.h>
24 #include <elm/genstruct/Vector.h>
26 #define DEFAULT_MAX_CHILDS 8
28 namespace otawa {
namespace tsim {
30 template <
class T1,
class T2>
67 template <
class T1,
class T2>
69 : _max_childs(max_childs), _childs(max_childs) {
74 template <
class T1,
class T2>
76 int l = _childs.length();
77 for(
int i=0 ; i < l ; i++){
86 template <
class T1,
class T2>
88 :_childs(max_childs), _max_childs(max_childs){
92 template <
class T1,
class T2>
94 : _max_childs(max_childs), _childs(max_childs) {
99 template <
class T1,
class T2>
101 : _max_childs(max_childs), _childs(max_childs){
107 template <
class T1,
class T2>
109 :_childs(max_childs), _max_childs(max_childs){
115 template <
class T1,
class T2>
117 int l = _childs.length();
118 for(
int i=0 ; i < l ; i++){
123 template <
class T1,
class T2>
127 for(
int i = from_index ; i < l ; i++){
139 template <
class T1,
class T2>
141 add(*path, data, from_index);
144 template <
class T1,
class T2>
148 for(
int i=from_index ; i < l ; i++){
156 template <
class T1,
class T2>
159 template <
class T1,
class T2>
164 template <
class T1,
class T2>
170 template <
class T1,
class T2>
Iterator(const TreePath< T1, T2 > *tree)
Definition: TreePath.h:165
int _max_childs
Definition: TreePath.h:35
elm::Option< T2 > get(const elm::genstruct::Vector< T1 > &path, int from_index=0)
Gives an optional value attached to the path given.
Definition: TreePath.h:145
TreePath< T1, T2 > * searchChild(const T1 &label) const
Definition: TreePath.h:75
T1 rootLabel() const
Definition: TreePath.h:157
~TreePath()
Destroys all his childs.
Definition: TreePath.h:116
elm::genstruct::Vector< TreePath< T1, T2 > * > _childs
Definition: TreePath.h:36
T1 _label
Definition: TreePath.h:33
inst add(int d, int a, int b)
Definition: inst.h:163
Definition: TreePath.h:58
TreePath(const T1 label, int max_childs=DEFAULT_MAX_CHILDS)
Definition: TreePath.h:68
Definition: TreePath.h:31
elm::Option< T2 > _data
Definition: TreePath.h:34
T2 rootData() const
Definition: TreePath.h:160
void add(elm::genstruct::Vector< T1 > &path, const T2 data, int from_index=0)
Adds a value attached to the path given.
Definition: TreePath.h:124
#define DEFAULT_MAX_CHILDS
Definition: TreePath.h:26