-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
executable file
·60 lines (52 loc) · 877 Bytes
/
utils.h
File metadata and controls
executable file
·60 lines (52 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* utils.h
*
* Created on: 2 May 2014
* Author: lester
*/
#ifndef UTILS_H_
#define UTILS_H_
/*
* Status machine using nodes
*
* each node contain a value and a list of destinations. last destination is null
*
* last node does not contain next
* a map for last node agains final values is need
*/
template<class T>
class _basic_node
{
T val;
_basic_node* next;
public:
_basic_node(const T& v, _basic_node* next) :
val(v), next(next)
{
}
T& operator *()
{
return *val;
}
};
template<class T, int N = 0>
class _status_base: public _basic_node<T>
{
_basic_node<T>* const next[N + 1];
public:
_status_base(const T& v) :
_basic_node<T>(v, next)
{
}
};
template<class T>
class _status_base<T,0>: public _basic_node<T>
{
public:
_status_base(const T& v) :
_basic_node<T>(v, nullptr)
{
}
};
//template<class T
#endif /* UTILS_H_ */