API Documentation
Loading...
Searching...
No Matches
Node.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: Node
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/BaseValues.h>
34namespace NDEVR
35{
37 {
38 public:
39 explicit TreeNode(uint04 index_start)
41 , m_child_start(-sint04(index_start))
42 {}
43
44 void clear(uint04 index_start)
45 {
46 setBegin(index_start);
48 }
49
50 void setBegin(uint04 index_start)
51 {
52 m_child_start = -sint04(index_start);
53 }
54 uint04 begin() const
55 {
56 return uint04(-m_child_start);
57 }
58
59 uint04 end() const
60 {
61 return uint04(-m_child_start) + size();
62 }
63 uint04 getChild(uint04 child_number) const
64 {
65 return uint04(m_child_start) + child_number;
66 }
67
69 {
70 return uint04(m_child_start);
71 }
72
74 {
75 m_child_start = sint04(left);
76 }
77
78 uint04 size() const
79 {
80 return m_element_size;
81 }
82 void setSize(uint04 bucket_size)
83 {
84 m_element_size = bucket_size;
85 }
86
87 bool isLeaf() const {
88 return m_child_start <= 0;
89 }
90
91 protected:
92 uint04 m_element_size; // Number of nodes belonging to this and its children
94 };
95}
Definition Node.hpp:37
void clear(uint04 index_start)
Definition Node.hpp:44
uint04 begin() const
Definition Node.hpp:54
bool isLeaf() const
Definition Node.hpp:87
void setSize(uint04 bucket_size)
Definition Node.hpp:82
uint04 end() const
Definition Node.hpp:59
uint04 size() const
Definition Node.hpp:78
void setChildNodeStart(uint04 left)
Definition Node.hpp:73
uint04 m_element_size
Definition Node.hpp:92
uint04 getChild(uint04 child_number) const
Definition Node.hpp:63
void setBegin(uint04 index_start)
Definition Node.hpp:50
TreeNode(uint04 index_start)
Definition Node.hpp:39
uint04 childNodeStart() const
Definition Node.hpp:68
sint04 m_child_start
Definition Node.hpp:93
Definition ACIColor.h:37
int32_t sint04
-Defines an alias representing a 4 byte, signed integer. -Can represent exact integer values -2147483...
Definition BaseValues.hpp:76
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:120