5 #ifndef VMML_ArrayTree_h
6 #define VMML_ArrayTree_h
12 template <
class NODETYPE>
28 _data->setUID(
nodes.size());
29 nodes.push_back(std::move(_data));
30 return nodes.size()-1;
37 int nodeid = _data->getUID();
38 NODETYPE
const& _parentkey = _data->getKey()->getParentKey();
40 if(_parentkey->getLod() > -1){
45 nodes[parentid]->setChildByKey(_data->getKey(), -1);
48 if(_data->isParent()) {
52 if(_data->getKey()->isLoaded()){
53 nodes[nodeid]->clear();
62 for (
int i = 0; i <
nodes.size();i++) {
64 if(
nodes[i]->getUID() != i) {
68 if(
nodes[i]->getParentID() == _nodeid) {
69 std::cout <<
"there is a problem with the nodeids while delete" << std::endl;
72 if(
nodes[i]->getParentID() > _nodeid) {
73 nodes[i]->setParentID(
nodes[i]->getParentID()-1);
77 nodes[i]->repairChildIdx(_nodeid);
109 if (_key->getLod() >
nodes[_id]->getKey()->getLod()) {
110 int childId =
nodes[_id]->locateKeyInChild(_key);
117 return nodes[_id]->getUID();
126 for (
int i = 0; i <
nodes.size();i++) {
128 std::cout << std::endl;
int addNode(NODETYPE _data)
Definition: ArrayTree.h:26
short minLoD
Definition: ArrayTree.h:154
NODETYPE const & getRoot() const
Definition: ArrayTree.h:133
NODETYPE const & getNodeAtIndex(int _index) const
Definition: ArrayTree.h:132
short maxDynamicLoD
Definition: ArrayTree.h:152
int getMaxLod() const
Definition: ArrayTree.h:136
Definition: AvalancheTrainingSimulationEngine.h:39
Definition: ArrayTree.h:13
short maxLoD
Definition: ArrayTree.h:153
ArrayTree()
Definition: ArrayTree.h:16
void setRootnode(NODETYPE _node)
Definition: ArrayTree.h:21
int getMinLod() const
Definition: ArrayTree.h:142
void setMinLod(int _inLod)
Definition: ArrayTree.h:143
size_t getSize()
Definition: ArrayTree.h:121
void removeNode(NODETYPE const &_data)
Definition: ArrayTree.h:33
void setMaxDynamicLod(int _inLod)
Definition: ArrayTree.h:147
void repairTreeUIDs(int _nodeid)
Definition: ArrayTree.h:60
int locateKey(NODETYPE const &_key, int _id)
Definition: ArrayTree.h:107
NODETYPE rootnode
Definition: ArrayTree.h:151
void print()
Definition: ArrayTree.h:125
int getMaxDynamicLod() const
Definition: ArrayTree.h:146
std::vector< NODETYPE > nodes
Definition: ArrayTree.h:150
~ArrayTree()
Definition: ArrayTree.h:17
void setMaxLod(int _inLod)
Definition: ArrayTree.h:137