PeriDyno 1.0.0
Loading...
Searching...
No Matches
NodeIterator.cpp
Go to the documentation of this file.
1#include "NodeIterator.h"
2#include "Node.h"
3
4namespace dyno
5{
6
8 {
9 node_current = nullptr;
10 }
11
12
13 NodeIterator::NodeIterator(std::list<Node*>& nList, std::map<ObjectId, std::shared_ptr<Node>>& nMap)
14 {
15 mNodeList.clear();
16
17 for (auto it = nList.begin(); it != nList.end(); ++it)
18 {
19 if (nMap.find((*it)->objectId()) != nMap.end()) {
20 mNodeList.push_back(nMap[(*it)->objectId()]);
21 }
22 }
23
24 node_current = mNodeList.empty() ? nullptr : mNodeList.front();
25
26 if (!mNodeList.empty())
27 mNodeList.pop_front();
28 }
29
30
35
37 {
38 node_current = mNodeList.empty() ? nullptr : mNodeList.front();
39
40 if (!mNodeList.empty())
41 mNodeList.pop_front();
42
43 return *this;
44 }
45
46
48 {
49 return operator++();
50 }
51
52 std::shared_ptr<Node> NodeIterator::operator->() const
53 {
54 return node_current;
55 }
56
57 std::shared_ptr<Node> NodeIterator::get() const
58 {
59 return node_current;
60 }
61
62 bool NodeIterator::operator!=(const NodeIterator& iterator) const
63 {
64 return node_current != iterator.get();
65 }
66
67 bool NodeIterator::operator==(const NodeIterator& iterator) const
68 {
69 return node_current == iterator.get();
70 }
71}
std::shared_ptr< Node > node_current
bool operator==(const NodeIterator &iterator) const
std::shared_ptr< Node > get() const
bool operator!=(const NodeIterator &iterator) const
std::shared_ptr< Node > operator->() const
NodeIterator & operator++()
std::list< std::shared_ptr< Node > > mNodeList
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
uint32_t ObjectId
Definition Object.h:110