forked from holubecmichal/MemGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode.cpp
63 lines (51 loc) · 1.22 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
/////////////////////////////////////////////////////////////////////////
//
// Bakalářská práce
// Vizualizace datových struktur pro verifikační nástroje
// Michael Holubec
// GNU LGPLv3
//
//////////////////////////////////////////////////////////////////////////
//
// Created by Michael Holubec on 15.02.16.
//
#include "node.h"
#include "graph_component.h"
namespace memgraph {
string_vector Node::available_attrs;
void Node::setName(std::string value) {
name = value;
}
const char *Node::getName() {
return name.c_str();
}
Attribute *Node::getAttr(std::string name) {
return attrs.getAttr(name);
}
Node *Node::setAttrs(Attributes *new_attrs) {
for (auto i : *new_attrs) {
checkAttr(i.first);
}
attrs.setAttrs(new_attrs);
return this;
}
bool Node::isAvailableAttr(std::string name) {
if (available_attrs.size() == 0) {
return true;
}
for (auto i : available_attrs) {
if (i == name) {
return true;
}
}
return false;
}
void Node::checkAttr(std::string name) {
if (!isAvailableAttr(name) && GraphComponent::enable_warnings) {
printWarning(name);
}
}
void Node::printWarning(std::string name) {
std::cerr << "Node: Unknown atribute " << name << std::endl;
}
}