| RDB 2

graphNode.hpp
Go to the documentation of this file.
1 /*
2 *******************************************************************************
3 *
4 * Copyright 2026 RIEGL Laser Measurement Systems
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * SPDX-License-Identifier: Apache-2.0
19 *
20 *******************************************************************************
21 */
22 /*!
23 *******************************************************************************
24 *
25 * \file graphNode.hpp
26 * \author RIEGL LMS GmbH, Austria
27 * \brief Index graph node
28 * \version 2015-10-14/AW: Initial version
29 * \version 2018-07-05/AW: Add ID conversion operator function
30 * \version 2021-07-09/AW: Add comparison operator and hash function (#3922)
31 *
32 *******************************************************************************
33 */
34
35 #ifndef RIEGL_RDB_POINTCLOUD_GRAPHNODE_HPP
36 #define RIEGL_RDB_POINTCLOUD_GRAPHNODE_HPP
37
38 //---< INCLUDES >---------------------------------------------------------------
39
40 #include <vector>
41 #include <cstdlib>
42 #include <cstdint>
43 #include <functional>
44
45 #include "riegl/rdb/pointcloud/transaction.hpp"
46
47 //---< NAMESPACE >--------------------------------------------------------------
48
49 namespace riegl {
50 namespace rdb {
51 namespace pointcloud {
52
53 //---< CLASS GraphNode >--------------------------------------------------------
54 /*!
55 * \brief Graph Node
56 *
57 * This class represents an index graph node. The index structure is
58 * used to organize the point cloud and consists of at least one node.
59 *
60 * The index space is given by the primary point attribute defined
61 * during point cloud database creation (see class CreateSettings).
62 *
63 * Each graph node covers a certain range of the index space and
64 * has a number of sub-nodes (aka. "child nodes"). All child nodes
65 * lie within the range of the parent node whereas they are usually
66 * smaller. A node without child nodes is called a leaf node. Note
67 * that any nodes may overlap in index space as well as all other
68 * point dimensions (attributes).
69 *
70 * This documentation uses the term "branch" for a node and all
71 * children and grandchildren up to and including the leaf nodes.
72 *
73 * \see riegl::rdb::Pointcloud::stat()
74 */
75 class GraphNode
76 {
77 public:
78 typedef std::uint32_t ID;
79 typedef std::uint64_t PointCount;
80
81 ID id; //!< unique node identifier (zero is invalid)
82 Transaction::ID revision; //!< ID of last transaction that has modified any attribute of this branch
83 std::vector<GraphNode> children; //!< list of child nodes (without grandchildren)
84 PointCount pointCountTotal; //!< total number of points in all leaf nodes of the branch
85 PointCount pointCountNode; //!< number of points in this node (see notes about LOD)
86
87 //! \brief return node identifier
88 operator ID() const { return id; }
89
90 public:
91 GraphNode();
92 };
93
94 inline bool operator==(const GraphNode &n1, const GraphNode &n2)
95 {
96 return (n1.id == n2.id) && (n1.revision == n2.revision);
97 }
98
99 }}} // namespace riegl::rdb::pointcloud
100
101 namespace std
102 {
103 template<>
104 struct hash<riegl::rdb::pointcloud::GraphNode>
105 {
106 std::size_t operator()(const riegl::rdb::pointcloud::GraphNode &node) const
107 {
108 return std::hash<std::uint64_t>()(
109 (std::uint64_t(node.id) << 32) | std::uint64_t(node.revision)
110 );
111 }
112 };
113 }
114
115 #endif // RIEGL_RDB_POINTCLOUD_GRAPHNODE_HPP
riegl::rdb::pointcloud::GraphNode::id
ID id
unique node identifier (zero is invalid)
Definition: graphNode.hpp:81
std
Definition: graphNode.hpp:101
riegl::rdb::pointcloud::GraphNode::pointCountNode
PointCount pointCountNode
number of points in this node (see notes about LOD)
Definition: graphNode.hpp:85
riegl::rdb::pointcloud::GraphNode::ID
std::uint32_t ID
Definition: graphNode.hpp:78
transaction.hpp
Point cloud transaction.
std::hash< riegl::rdb::pointcloud::GraphNode >::operator()
std::size_t operator()(const riegl::rdb::pointcloud::GraphNode &node) const
Definition: graphNode.hpp:106
riegl
RIEGL Laser Measurement Systems GmbH, Austria.
Definition: context.hpp:48
riegl::rdb::pointcloud::GraphNode::children
std::vector< GraphNode > children
list of child nodes (without grandchildren)
Definition: graphNode.hpp:83
riegl::rdb::pointcloud::operator==
bool operator==(const GraphNode &n1, const GraphNode &n2)
Definition: graphNode.hpp:94
riegl::rdb::pointcloud::GraphNode
Graph Node.
Definition: graphNode.hpp:75
riegl::rdb::pointcloud::GraphNode::pointCountTotal
PointCount pointCountTotal
total number of points in all leaf nodes of the branch
Definition: graphNode.hpp:84
riegl::rdb::pointcloud::Transaction::ID
std::uint32_t ID
Definition: transaction.hpp:60
riegl::rdb::pointcloud::GraphNode::revision
Transaction::ID revision
ID of last transaction that has modified any attribute of this branch.
Definition: graphNode.hpp:82
riegl::rdb::pointcloud::GraphNode::GraphNode
GraphNode()
riegl::rdb::pointcloud::GraphNode::PointCount
std::uint64_t PointCount
Definition: graphNode.hpp:79