-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.cc
45 lines (34 loc) · 839 Bytes
/
node.cc
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
#include "node.h"
#include <limits>
namespace flow_graphs {
Node::Node(const string& name, NodeType node_type)
: name_(name),
node_type_(node_type),
value_(-std::numeric_limits<Value>::max()) {
}
void Node::set_name(const string& name) {
name_ = name;
}
void Node::set_parents(const Nodes& parents) {
parents_.assign(parents.begin(), parents.end());
}
void Node::set_children(const Nodes& children) {
children_.assign(children.begin(), children.end());
}
void Node::add_parent(Node* parent) {
if (parent != NULL) {
parents_.push_back(parent);
}
}
void Node::add_child(Node* child) {
if (child != NULL) {
children_.push_back(child);
}
}
void Node::set_value(Value value) {
value_ = value;
}
void Node::Reset() {
value_ = -std::numeric_limits<Value>::max();
}
} // namespace flow_graphs