forked from kovacsv/VisualScriptEngineWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNE_NodeList.cpp
More file actions
86 lines (69 loc) · 1.32 KB
/
NE_NodeList.cpp
File metadata and controls
86 lines (69 loc) · 1.32 KB
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
#include "NE_NodeList.hpp"
#include "NE_Debug.hpp"
namespace NE
{
NodeList::NodeList () :
nodes ()
{
}
NodeList::~NodeList ()
{
}
bool NodeList::IsEmpty () const
{
return nodes.IsEmpty ();
}
size_t NodeList::Count () const
{
return nodes.Count ();
}
bool NodeList::ContainsNode (const NodeId& nodeId) const
{
return nodes.Contains (nodeId);
}
NodePtr NodeList::GetNode (const NodeId& nodeId)
{
if (DBGERROR (!nodes.Contains (nodeId))) {
return nullptr;
}
return nodes.GetValue (nodeId);
}
NodeConstPtr NodeList::GetNode (const NodeId& nodeId) const
{
if (DBGERROR (!nodes.Contains (nodeId))) {
return nullptr;
}
return nodes.GetValue (nodeId);
}
bool NodeList::AddNode (const NodeId& nodeId, const NodePtr& nodePtr)
{
if (DBGERROR (nodeId == NullNodeId)) {
return false;
}
return nodes.Insert (nodeId, nodePtr);
}
bool NodeList::DeleteNode (const NodeId& nodeId)
{
return nodes.Erase (nodeId);
}
void NodeList::MakeSorted ()
{
nodes.MakeSorted ();
}
void NodeList::Clear ()
{
nodes.Clear ();
}
void NodeList::Enumerate (const std::function<bool (NodePtr)>& processor)
{
nodes.Enumerate ([&] (NodePtr& node) {
return processor (node);
});
}
void NodeList::Enumerate (const std::function<bool (NodeConstPtr)>& processor) const
{
nodes.Enumerate ([&] (const NodePtr& node) {
return processor (node);
});
}
}