RDB 2
openSettings.hpp
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  *
4  * Copyright 2023 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 openSettings.hpp
26  * \author RIEGL LMS GmbH, Austria
27  * \brief Database open settings
28  * \version 2015-10-14/AW: Initial version
29  * \version 2016-09-22/AW: Parameter 'cacheSize' changed from 32 to 64 bit type
30  * \version 2016-12-19/AW: New functions to load/save settings from/to JSON
31  * \version 2017-03-28/AW: Documentation of JSON load/save functions updated
32  * \version 2017-11-24/AW: Constructors declared as "explicit" (#2825)
33  * \version 2019-02-15/AW: Fix C++ API wrapper of OpenSettings class
34  * \version 2020-02-21/AW: Class 'OpenSettings' is now context-free (#3544)
35  *
36  *******************************************************************************
37  */
38 
39 #ifndef RIEGL_RDB_POINTCLOUD_OPENSETTINGS_HPP
40 #define RIEGL_RDB_POINTCLOUD_OPENSETTINGS_HPP
41 
42 //---< INCLUDES >---------------------------------------------------------------
43 
44 #include <cstdlib>
45 #include <cstdint>
46 
47 #include "riegl/rdb/context.hpp"
48 
49 //---< NAMESPACE >--------------------------------------------------------------
50 
51 namespace riegl {
52 namespace rdb {
53 namespace pointcloud {
54 
55 //---< CLASS OpenSettings >-----------------------------------------------------
56 /*!
57  * \brief Database open settings
58  *
59  * This class defines settings for opening a point cloud database.
60  */
62 {
63 public:
64  /*!
65  * \brief Point cache size
66  *
67  * The database engine may buffer read and write operations in an
68  * internal cache. This value defines the cache size in bytes (octets).
69  *
70  * Default: 500 MB
71  */
72  std::uint64_t cacheSize;
73 
74 public:
75  ~OpenSettings();
76 
77  /*!
78  * \brief Default constructor
79  *
80  * All properties are set to default values.
81  */
82  OpenSettings();
83 
84  /// \deprecated since 2.2.3 - use the context-free constructors instead
85  explicit OpenSettings(riegl::rdb::Context &context);
86 
87  /*!
88  * \brief Copy constructor
89  *
90  * All properties are copied from the given settings object.
91  */
92  OpenSettings(const OpenSettings &settings);
93 
94  /*!
95  * \brief Assignment operator
96  *
97  * All properties are copied from the given settings object.
98  */
99  OpenSettings& operator=(const OpenSettings &settings);
100 
101  /*!
102  * \brief Load settings from JSON string
103  *
104  * This function parses the given JSON string and applies all available
105  * properties - missing properties are silently ignored (i.e. the value
106  * remains unchanged). When parsing the JSON string fails, an exception
107  * is thrown.
108  *
109  * Example JSON string:
110  *
111  * {
112  * "cache_size": 524288000
113  * }
114  */
115  void load(const std::string &json);
116 
117  /*!
118  * \brief Save settings to JSON string
119  * \see load()
120  */
121  std::string save() const;
122 
123 private:
124  friend class OpenSettingsWrapper;
125  void *data;
126 };
127 
128 }}} // namespace riegl::rdb::pointcloud
129 
130 #endif // RIEGL_RDB_POINTCLOUD_OPENSETTINGS_HPP
riegl::rdb::pointcloud::OpenSettings::~OpenSettings
~OpenSettings()
riegl::rdb::pointcloud::OpenSettings::save
std::string save() const
Save settings to JSON string.
context.hpp
RDB library context.
riegl
RIEGL Laser Measurement Systems GmbH, Austria.
Definition: context.hpp:48
riegl::rdb::pointcloud::OpenSettings::operator=
OpenSettings & operator=(const OpenSettings &settings)
Assignment operator.
riegl::rdb::pointcloud::OpenSettings
Database open settings.
Definition: openSettings.hpp:61
riegl::rdb::pointcloud::OpenSettings::cacheSize
std::uint64_t cacheSize
Point cache size.
Definition: openSettings.hpp:72
riegl::rdb::pointcloud::OpenSettings::OpenSettingsWrapper
friend class OpenSettingsWrapper
Definition: openSettings.hpp:124
riegl::rdb::pointcloud::OpenSettings::OpenSettings
OpenSettings()
Default constructor.
riegl::rdb::pointcloud::OpenSettings::load
void load(const std::string &json)
Load settings from JSON string.
riegl::rdb::Context
Library context.
Definition: context.hpp:75