forked from Conedy/Conedy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.cpp
159 lines (117 loc) · 4.05 KB
/
node.cpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include "node.h"
#include "edge.h"
#include "gslNoise.h"
#include "dynNode.h"
namespace conedy
{
baseType edge::getTargetState() { return dynNode::lookUp(targetNumber)->getState(); }
node::node () { number = numeric_limits<nodeDescriptor>::max(); };
node::~node() {
if (number != numeric_limits<nodeDescriptor>::max())
theNodes[number] = NULL;
};
vector<node *> node::theNodes;
baseType edgeVirtual::getTargetState() { return dynNode::lookUp(getTarget())->getState();}
// inline node* edge::getTarget() { return node::theNodes [targetNumber];}
ostream& edgeVirtual::printStatistics( ostream &os, int edgeVerbosity, int theEdgeKind, string theEdgeName, baseType weight)
{
if (edgeVerbosity >= 1)
{
os << dynNode::lookUp(targetNumber)->getNumber() << "\t";
}
// Ausgabe Kind, Name
if (edgeVerbosity >= 2)
{
cout << "(";
edgeInfo ei = getEdgeInfo();
// os << "EdgeKind = " << theEdgeKind << "\t";
os << theEdgeName << ", ";
// Ausgabe Gewicht
os << weight;
}
if (edgeVerbosity >= 2)
os << "), ";
return os;
};
ostream& edgeVirtual::printStatistics ( ostream &os, int edgeVerbosity)
{
edgeInfo ei = getEdgeInfo();
printStatistics(os, edgeVerbosity, ei.theEdgeKind, ei.theEdgeName, getWeight());
return os;
}
ostream& edge::printStatistics( ostream &os, int edgeVerbosity, int theEdgeKind, string theEdgeName, baseType weight)
{
if (edgeVerbosity >= 1)
{
os << dynNode::lookUp(targetNumber)->getNumber() << "\t";
}
// Ausgabe Kind, Name
if (edgeVerbosity >= 2)
{
cout << "(";
edgeInfo ei = getEdgeInfo();
// os << "EdgeKind = " << theEdgeKind << "\t";
os << theEdgeName << ", ";
// Ausgabe Gewicht
os << weight;
}
if (edgeVerbosity >= 2)
os << "), ";
return os;
};
// ostream& edgeVirtual::printStatistics ( ostream &os, int edgeVerbosity)
// {
// edgeInfo ei = getEdgeInfo();
// edge::printStatistics(os, edgeVerbosity, ei.theEdgeKind, ei.theEdgeName, getWeight());
// return os;
// }
void node::printEdgeStatistics(ostream &os, int edgeVerbosity)
{
}
void node::printStatistics(ostream &os, int nodeVerbosity, int edgeVerbosity)
{
if (nodeVerbosity >= 1)
{
cout << "nodeName:\t"<< getNodeInfo().theNodeName << endl;
// cout << "nodeType:\t"<< (int)getNodeInfo().theNodeType << endl;
cout << "nodeKind:\t" ;
if (getNodeInfo().theNodeKind & _dynNode_)
cout << "dynNode ";
if (getNodeInfo().theNodeKind & _inNode_)
cout << "inNode ";
if (getNodeInfo().theNodeKind & _outNode_)
cout << "outNode ";
if (getNodeInfo().theNodeKind & _ode_)
cout << "ode ";
if (getNodeInfo().theNodeKind & _sde_)
cout << "sde ";
if (getNodeInfo().theNodeKind & _pco_)
cout << "pco ";
if (getNodeInfo().theNodeKind & _pcoDelay_)
cout << "pcoDelay ";
if (getNodeInfo().theNodeKind & _mapNode_)
cout << "map ";
cout << endl;
}
cout << "nodeNumber:\t" << getNumber() << endl;
printEdgeStatistics(os, edgeVerbosity);
}
bool match (nodeDescriptor l, nodeDescriptor r) { return l == r; };
bool match (nodeKind l, nodeDescriptor r) { return dynNode::lookUp(r)-> getNodeInfo().theNodeKind & l; };
bool match (nodeDescriptor l, nodeKind r) { return dynNode::lookUp(l)-> getNodeInfo().theNodeKind & r; };
bool match (nodeDescriptor l, networkElementType r) { return dynNode::lookUp(l)->getNodeInfo().theNodeType == r; };
bool match (networkElementType l, nodeDescriptor r) { return dynNode::lookUp(r)->getNodeInfo().theNodeType == l; };
/*
template <typename baseType>
class timeCounter : public nodeVirtualEdges<baseType>
{
public:
timeCounter() : nodeVirtualEdges<baseType> ( 0 ) { this->time = 0; };
virtual void action() { this->time ++;}
virtual int requiredTimeSteps() {return 1;};
virtual void clean ( int timeSteps ) { this->time = 0;};
int getTime() {return this->time; };
virtual nodeVirtualEdges<baseType> *construct() { return new timeCounter<baseType> ( *this ); };
};
*/
}