RDB 2: riegl/rdb/context.hpp Source File

| RDB 2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
context.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 context.hpp
26 * \author RIEGL LMS GmbH, Austria
27 * \brief RDB library context
28 * \version 2015-10-14/AW: Initial version
29 * \version 2017-01-30/AW: Added function to check if a file is a RDB 2 file
30 * \version 2017-11-24/AW: Constructors declared as "explicit" (#2825)
31 * \version 2018-01-10/AW: Added friend class "pointcloud::Management"
32 * \version 2020-06-29/AW: Database changelog interface added (#3614)
33 * \version 2020-09-17/AW: Added function libraryFilename()
34 *
35 *******************************************************************************
36 */
37
38 #ifndef RIEGL_RDB_CONTEXT_HPP
39 #define RIEGL_RDB_CONTEXT_HPP
40
41 //---< INCLUDES >---------------------------------------------------------------
42
43 #include <string>
44 #include <memory>
45
46 //---< NAMESPACE >--------------------------------------------------------------
47
48 namespace riegl {
49 namespace rdb {
50
51 //---< FORWARD DECLARATIONS >---------------------------------------------------
52
53 struct PointcloudData;
54
55 namespace pointcloud
56 {
57 class CreateSettings;
58 class OpenSettings;
59 class PointAttributes;
60 class PointAttribute;
61 class QueryInsert;
62 class QueryUpdate;
63 class QueryRemove;
64 class QueryInvert;
65 class QueryFill;
66 class Transaction;
67 class Management;
68 class Changelog;
69 }
70
71 //---< CLASS Context >----------------------------------------------------------
72 /*!
73 * \brief Library context
74 */
75 class Context
76 {
77 public:
78 /*!
79 * \brief Constructor
80 *
81 * Use _logPath_ to specify the target folder for RDB log files. If not
82 * defined (empty string), then system's folder for temporary files is
83 * used (i.e. Windows: "C:\Users\*\AppData\Local\Temp", Linux: "/tmp"). If
84 * the given path does not exist, it is not created and logging is disabled.
85 *
86 * Use _logLevel_ to specify a filter for log messages. Allowed values are
87 *
88 * | Level | Description |
89 * | ------- | -------------------------- |
90 * | TRACE | many debug messages |
91 * | DEBUG | some debug messages |
92 * | TEXT | general messages = default |
93 * | INFO | hints, information |
94 * | WARNING | warning messages |
95 * | ERROR | error messages |
96 * | FATAL | fatal errors |
97 * | NONE | no log output at all |
98 *
99 * Whereas "TRACE" is the highest log level and means to output everything
100 * and "NONE" is the lowest level and means to output nothing. Example:
101 * if _logLevel_ is set to "TEXT", debug messages are not output but info,
102 * warnings, errors and fatal errors are.
103 *
104 * Both _logPath_ and _logLevel_ may also be given as environment variables
105 * "RDB_LOG_PATH" and "RDB_LOG_LEVEL". Please note that those variables are
106 * used only if empty strings are passed to the constructor.
107 *
108 * \note When the context is deleted, the log file is also deleted but
109 * only if it does not contain WARNING, ERROR or FATAL messages.
110 * To keep the context from deleting the log file, append "!" to
111 * the _logLevel_, e.g. "TEXT!".
112 */
113 explicit Context(
114 const std::string &logLevel = "", //!< [in] log level (filter), see description
115 const std::string &logPath = "" //!< [in] target folder for RDB log files
116 );
117
118 /*!
119 * \brief Destructor
120 */
121 ~Context();
122
123 /*!
124 * \brief Returns library name
125 */
126 std::string libraryName() const;
127
128 /*!
129 * \brief Returns the name of the file the library was loaded from
130 * \since 2.3.0
131 */
132 std::string libraryFilename() const;
133
134 /*!
135 * \brief Returns library version string
136 */
137 std::string libraryVersion() const;
138
139 /*!
140 * \brief Returns library license text
141 */
142 std::string libraryLicense() const;
143
144 /*!
145 * \brief Database file type title
146 *
147 * \returns "RDB 2 Database File"
148 */
149 std::string databaseFileTypeTitle() const;
150
151 /*!
152 * \brief Database file type suffix
153 *
154 * \returns "rdbx"
155 */
156 std::string databaseFileTypeSuffix() const;
157
158 /*!
159 * \brief Check file type
160 *
161 * \returns true if the given location is a RDB 2 database file.
162 */
163 bool databaseFileTypeCheck(const std::string &location) const;
164
165 private:
166 struct Private;
167 std::shared_ptr<Private> data;
168
169 friend class Logger;
170 friend struct PointcloudData;
171 friend class pointcloud::CreateSettings;
172 friend class pointcloud::OpenSettings;
173 friend class pointcloud::PointAttributes;
174 friend class pointcloud::PointAttribute;
175 friend class pointcloud::QueryInsert;
176 friend class pointcloud::QueryUpdate;
177 friend class pointcloud::QueryRemove;
178 friend class pointcloud::QueryInvert;
179 friend class pointcloud::QueryFill;
180 friend class pointcloud::Transaction;
181 friend class pointcloud::Management;
182 friend class pointcloud::Changelog;
183 };
184
185 }} // namespace riegl::rdb
186
187 #endif // RIEGL_RDB_CONTEXT_HPP
riegl::rdb::Context::databaseFileTypeSuffix
std::string databaseFileTypeSuffix() const
Database file type suffix.
riegl::rdb::Context::~Context
~Context()
Destructor.
riegl::rdb::pointcloud::PointAttributes
Manage point attributes.
Definition: pointAttributes.hpp:83
riegl::rdb::Context
Library context.
Definition: context.hpp:75
riegl::rdb::Context::libraryLicense
std::string libraryLicense() const
Returns library license text.
riegl::rdb::Context::databaseFileTypeCheck
bool databaseFileTypeCheck(const std::string &location) const
Check file type.
riegl::rdb::Context::PointcloudData
friend struct PointcloudData
Definition: context.hpp:170
riegl::rdb::Context::Logger
friend class Logger
Definition: context.hpp:169
riegl::rdb::pointcloud::Transaction
Point cloud transaction.
Definition: transaction.hpp:57
riegl::rdb::pointcloud::QueryFill
Point fill query.
Definition: queryFill.hpp:71
riegl::rdb::Context::libraryVersion
std::string libraryVersion() const
Returns library version string.
riegl::rdb::pointcloud::QueryInsert
Point insert query.
Definition: queryInsert.hpp:67
riegl::rdb::pointcloud::OpenSettings
Database open settings.
Definition: openSettings.hpp:61
riegl::rdb::pointcloud::CreateSettings
Database create settings.
Definition: createSettings.hpp:67
riegl::rdb::Context::databaseFileTypeTitle
std::string databaseFileTypeTitle() const
Database file type title.
riegl::rdb::pointcloud::PointAttribute
Point attribute description.
Definition: pointAttribute.hpp:120
riegl::rdb::Context::libraryName
std::string libraryName() const
Returns library name.
riegl::rdb::pointcloud::QueryInvert
Point invert query.
Definition: queryInvert.hpp:77
riegl::rdb::pointcloud::QueryUpdate
Point update query.
Definition: queryUpdate.hpp:66
riegl::rdb::pointcloud::Changelog
Manage point cloud changelog.
Definition: changelog.hpp:76
riegl::rdb::pointcloud::QueryRemove
Point remove query.
Definition: queryRemove.hpp:65
riegl::rdb::Context::Context
Context(const std::string &logLevel="", const std::string &logPath="")
Constructor.
riegl::rdb::Context::libraryFilename
std::string libraryFilename() const
Returns the name of the file the library was loaded from.
riegl::rdb::pointcloud::Management
Basic point cloud management interface.
Definition: management.hpp:64