API Documentation
Loading...
Searching...
No Matches
TreeIterator.hpp
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Tree
28File: TreeIterator
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/BaseValues.h>
34
35namespace NDEVR
36{
38 {
39 public:
40 explicit TreeIterator(uint04 start_index)
41 : m_depth(0)
42 {
43 node_stack[0] = start_index;
44 }
45 uint04 get() const
46 {
47 return node_stack[m_depth];
48 }
49 bool valid() const
50 {
51 return m_depth != 255;
52 }
53 void pop()
54 {
55 --m_depth;
56 }
58 {
59 return m_depth;
60 }
62 {
63 node_stack[++m_depth] = index;
64 }
65 void addAndGoToIndex(uint04 index_a, uint04 index_b)
66 {
67 node_stack[++m_depth] = index_b;
68 node_stack[++m_depth] = index_a;
69 }
70
72 {
73 const uint04 end = size + start;
74 for(uint04 i = start; i < end; i++)
75 node_stack[++m_depth] = i;
76 }
77
78 private:
79 uint04 node_stack[256];
80 uint01 m_depth;
81 };
82}
Definition TreeIterator.hpp:38
void addAndGoToIndex(uint04 index_a, uint04 index_b)
Definition TreeIterator.hpp:65
void pop()
Definition TreeIterator.hpp:53
bool valid() const
Definition TreeIterator.hpp:49
TreeIterator(uint04 start_index)
Definition TreeIterator.hpp:40
uint01 depth()
Definition TreeIterator.hpp:57
void addAndGoToIndices(uint04 start, uint04 size)
Definition TreeIterator.hpp:71
void addAndGoToIndex(uint04 index)
Definition TreeIterator.hpp:61
uint04 get() const
Definition TreeIterator.hpp:45
Definition ACIColor.h:37
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:98
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120