RDB 2
context.hpp
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  *
4  * Copyright 2021 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 Transaction;
62  class Management;
63  class Changelog;
64 }
65 
66 //---< CLASS Context >----------------------------------------------------------
67 /*!
68  * \brief Library context
69  */
70 class Context
71 {
72 public:
73  /*!
74  * \brief Constructor
75  *
76  * Use _logPath_ to specify the target folder for RDB log files. If not
77  * defined (empty string), then system's folder for temporary files is
78  * used (i.e. Windows: "C:\Users\*\AppData\Local\Temp", Linux: "/tmp"). If
79  * the given path does not exist, it is not created and logging is disabled.
80  *
81  * Use _logLevel_ to specify a filter for log messages. Allowed values are
82  *
83  * | Level | Description |
84  * | ------- | -------------------------- |
85  * | TRACE | many debug messages |
86  * | DEBUG | some debug messages |
87  * | TEXT | general messages = default |
88  * | INFO | hints, information |
89  * | WARNING | warning messages |
90  * | ERROR | error messages |
91  * | FATAL | fatal errors |
92  * | NONE | no log output at all |
93  *
94  * Whereas "TRACE" is the highest log level and means to output everything
95  * and "NONE" is the lowest level and means to output nothing. Example:
96  * if _logLevel_ is set to "TEXT", debug messages are not output but info,
97  * warnings, errors and fatal errors are.
98  *
99  * Both _logPath_ and _logLevel_ may also be given as environment variables
100  * "RDB_LOG_PATH" and "RDB_LOG_LEVEL". Please note that those variables are
101  * used only if empty strings are passed to the constructor.
102  *
103  * \note When the context is deleted, the log file is also deleted but
104  * only if it does not contain WARNING, ERROR or FATAL messages.
105  * To keep the context from deleting the log file, append "!" to
106  * the _logLevel_, e.g. "TEXT!".
107  */
108  explicit Context(
109  const std::string &logLevel = "", //!< [in] log level (filter), see description
110  const std::string &logPath = "" //!< [in] target folder for RDB log files
111  );
112 
113  /*!
114  * \brief Destructor
115  */
116  ~Context();
117 
118  /*!
119  * \brief Returns library name
120  */
121  std::string libraryName() const;
122 
123  /*!
124  * \brief Returns the name of the file the library was loaded from
125  * \since 2.3.0
126  */
127  std::string libraryFilename() const;
128 
129  /*!
130  * \brief Returns library version string
131  */
132  std::string libraryVersion() const;
133 
134  /*!
135  * \brief Returns library license text
136  */
137  std::string libraryLicense() const;
138 
139  /*!
140  * \brief Database file type title
141  *
142  * \returns "RDB 2 Database File"
143  */
144  std::string databaseFileTypeTitle() const;
145 
146  /*!
147  * \brief Database file type suffix
148  *
149  * \returns "rdbx"
150  */
151  std::string databaseFileTypeSuffix() const;
152 
153  /*!
154  * \brief Check file type
155  *
156  * \returns true if the given location is a RDB 2 database file.
157  */
158  bool databaseFileTypeCheck(const std::string &location) const;
159 
160 private:
161  struct Private;
162  std::shared_ptr<Private> data;
163 
164  friend class Logger;
165  friend struct PointcloudData;
172  friend class pointcloud::Changelog;
173 };
174 
175 }} // namespace riegl::rdb
176 
177 #endif // RIEGL_RDB_CONTEXT_HPP
Library context.
Definition: context.hpp:70
Point cloud transaction.
Definition: transaction.hpp:55
RIEGL Laser Measurement Systems GmbH, Austria.
Definition: context.hpp:48
Point attribute description.
Manage point cloud changelog.
Definition: changelog.hpp:74
Basic point cloud management interface.
Definition: management.hpp:62