GCC Code Coverage Report


Directory: ./
File: build/openvdb/openvdb/openvdb/version.h
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 2 2 100.0%
Functions: 0 0 -%
Branches: 5 10 50.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 /// @file openvdb/version.h
5 /// @brief Library and file format version numbers
6 ///
7 /// @details
8 /// When the library is built with the latest ABI, its namespace has the form
9 /// <B>openvdb::vX_Y</B>, where @e X and @e Y are the major and minor version
10 /// numbers.
11 ///
12 /// The library can be built using an older ABI by changing the value of the
13 /// @b OPENVDB_ABI_VERSION_NUMBER. (e.g., via <TT>-DOPENVDB_ABI_VERSION_NUMBER=<I>N</I></TT>).
14 /// In that case, the namespace has the form <B>openvdb::vX_YabiN</B>,
15 /// where N is the ABI version number.
16 ///
17 /// The ABI version must be set consistently when building code that depends on
18 /// OpenVDB.
19 ///
20 /// The ABI version number defaults to the library major version number, which
21 /// gets incremented whenever changes are made to the ABI of the Grid class or
22 /// related classes (Tree, Transform, Metadata, etc.). Setting the ABI version
23 /// number to an earlier library version number disables grid ABI changes made
24 /// since that library version.
25 ///
26 /// The library minor version number gets incremented whenever a change is made
27 /// to any aspect of the public API (not just the grid API) that necessitates
28 /// changes to client code. Changes to APIs in private or internal namespaces
29 /// do not trigger a minor version number increment; such APIs should not be
30 /// used in client code.
31 ///
32 /// A patch version number increment indicates a change&mdash;usually a new
33 /// feature or a bug fix&mdash;that does not necessitate changes to client code
34 /// but rather only recompilation of that code (because the library namespace
35 /// incorporates the version number).
36 ///
37 /// The file format version number gets incremented when it becomes possible to
38 /// write files that cannot safely be read with older versions of the library.
39 /// Not all files written in a newer format are incompatible with older
40 /// libraries, however. And in general, files containing grids of unknown type
41 /// can be read safely, although the unknown grids will not be accessible.
42
43 #ifndef OPENVDB_VERSION_HAS_BEEN_INCLUDED
44 #define OPENVDB_VERSION_HAS_BEEN_INCLUDED
45
46 #include "openvdb/Platform.h"
47
48 #include <cstddef> // size_t
49 #include <cstdint> // uint32_t
50
51 ///////////////////////////////////////////////////////////////////////////////
52 ///////////////////////////////////////////////////////////////////////////////
53
54 // Auto generated build configurations from CMake
55
56 ///@{
57 /// @brief Library major, minor and patch version numbers
58 /// @hideinitializer
59 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 9
60 /// @hideinitializer
61 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 1
62 /// @hideinitializer
63 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 1
64 ///@}
65
66 /// @note This ifndef exists for compatibility with older versions of OpenVDB.
67 /// This value should never be different from the value configured when
68 /// OpenVDB was built, but this previously needed to be defined by downstream
69 /// software. Redefining it here would cause build failures, so this allows
70 /// users to transition and remove the define in their build systems.
71 #ifndef OPENVDB_ABI_VERSION_NUMBER
72 /// @brief The ABI version that OpenVDB was built with
73 /// @hideinitializer
74 #define OPENVDB_ABI_VERSION_NUMBER 9
75 #endif
76
77 /// @brief Library version number string of the form "<major>.<minor>.<patch>"
78 /// @details This is a macro rather than a static constant because we typically
79 /// want the compile-time version number, not the runtime version number
80 /// (although the two are usually the same).
81 /// @hideinitializer
82 #define OPENVDB_LIBRARY_VERSION_STRING "9.1.1"
83
84 /// @brief Library version number string of the form "<major>.<minor>.<patch>abi<abi>"
85 /// @details This is a macro rather than a static constant because we typically
86 /// want the compile-time version number, not the runtime version number
87 /// (although the two are usually the same).
88 /// @hideinitializer
89 #define OPENVDB_LIBRARY_ABI_VERSION_STRING "9.1.1abi9"
90
91 /// @brief Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
92 /// @hideinitializer
93 #define OPENVDB_LIBRARY_VERSION_NUMBER 151060481
94
95 /// @brief The version namespace name for this library version
96 /// @hideinitializer
97 ///
98 /// When the ABI version number matches the library major version number,
99 /// symbols are named as in the following examples:
100 /// - @b openvdb::vX_Y::Vec3i
101 /// - @b openvdb::vX_Y::io::File
102 /// - @b openvdb::vX_Y::tree::Tree
103 ///
104 /// where X and Y are the major and minor version numbers.
105 ///
106 /// When the ABI version number does not match the library major version number,
107 /// symbol names include the ABI version:
108 /// - @b openvdb::vX_YabiN::Vec3i
109 /// - @b openvdb::vX_YabiN::io::File
110 /// - @b openvdb::vX_YabiN::tree::Tree
111 ///
112 /// where X, Y and N are the major, minor and ABI version numbers, respectively.
113 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
114 #define OPENVDB_VERSION_NAME v9_1
115 #else
116 #define OPENVDB_VERSION_NAME v9_1abi9
117 #endif
118
119 /* Denotes whether VDB was built with IMath Half support */
120 #ifndef OPENVDB_USE_IMATH_HALF
121 /* #undef OPENVDB_USE_IMATH_HALF */
122 /* Denotes whether VDB was built against Imath 3+ */
123 /* #undef OPENVDB_IMATH_VERSION */
124 #endif
125
126 /* Denotes whether VDB was built with Blosc support */
127 #ifndef OPENVDB_USE_BLOSC
128 #define OPENVDB_USE_BLOSC
129 #endif
130
131 /* Denotes whether VDB was built with ZLIB support */
132 #ifndef OPENVDB_USE_ZLIB
133 #define OPENVDB_USE_ZLIB
134 #endif
135
136 /* Denotes whether VDB was built with explicit template instantiation */
137 #ifndef OPENVDB_USE_EXPLICIT_INSTANTIATION
138 #define OPENVDB_USE_EXPLICIT_INSTANTIATION
139 #endif
140
141 /* Defines the macros for explicit template declarations. */
142 #define OPENVDB_INSTANTIATE extern template OPENVDB_TEMPLATE_IMPORT
143 #define OPENVDB_INSTANTIATE_CLASS extern template class OPENVDB_TEMPLATE_IMPORT
144 #define OPENVDB_INSTANTIATE_STRUCT extern template struct OPENVDB_TEMPLATE_IMPORT
145
146 /* Defines the macros for explicit template instantiations. */
147 #define OPENVDB_REAL_TREE_INSTANTIATE(Function) \
148 OPENVDB_INSTANTIATE Function(FloatTree); \
149 OPENVDB_INSTANTIATE Function(DoubleTree);
150 #define OPENVDB_NUMERIC_TREE_INSTANTIATE(Function) \
151 OPENVDB_INSTANTIATE Function(Int32Tree); \
152 OPENVDB_INSTANTIATE Function(Int64Tree); \
153 OPENVDB_INSTANTIATE Function(FloatTree); \
154 OPENVDB_INSTANTIATE Function(DoubleTree);
155 #define OPENVDB_VEC3_TREE_INSTANTIATE(Function) \
156 OPENVDB_INSTANTIATE Function(Vec3STree); \
157 OPENVDB_INSTANTIATE Function(Vec3DTree); \
158 OPENVDB_INSTANTIATE Function(Vec3ITree);
159 #define OPENVDB_VOLUME_TREE_INSTANTIATE(Function) \
160 OPENVDB_INSTANTIATE Function(BoolTree); \
161 OPENVDB_INSTANTIATE Function(Int32Tree); \
162 OPENVDB_INSTANTIATE Function(Int64Tree); \
163 OPENVDB_INSTANTIATE Function(FloatTree); \
164 OPENVDB_INSTANTIATE Function(DoubleTree); \
165 OPENVDB_INSTANTIATE Function(Vec3STree); \
166 OPENVDB_INSTANTIATE Function(Vec3DTree); \
167 OPENVDB_INSTANTIATE Function(Vec3ITree);
168 #define OPENVDB_ALL_TREE_INSTANTIATE(Function) \
169 OPENVDB_INSTANTIATE Function(MaskTree); \
170 OPENVDB_INSTANTIATE Function(points::PointDataTree); \
171 OPENVDB_INSTANTIATE Function(BoolTree); \
172 OPENVDB_INSTANTIATE Function(Int32Tree); \
173 OPENVDB_INSTANTIATE Function(Int64Tree); \
174 OPENVDB_INSTANTIATE Function(FloatTree); \
175 OPENVDB_INSTANTIATE Function(DoubleTree); \
176 OPENVDB_INSTANTIATE Function(Vec3STree); \
177 OPENVDB_INSTANTIATE Function(Vec3DTree); \
178 OPENVDB_INSTANTIATE Function(Vec3ITree);
179
180 ///////////////////////////////////////////////////////////////////////////////
181 ///////////////////////////////////////////////////////////////////////////////
182
183
184 #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
185 // If using a future OPENVDB_ABI_VERSION_NUMBER, issue a message directive.
186 // This can be suppressed by defining OPENVDB_USE_FUTURE_ABI_<VERSION>=ON.
187 // Note that, whilst the VDB CMake does not allow this option to be hit,
188 // it exists to propagate this message to downstream targets
189 #if OPENVDB_ABI_VERSION_NUMBER == 10
190 #ifndef OPENVDB_USE_FUTURE_ABI_10
191 PRAGMA(message("NOTE: ABI = 10 is still in active development and has not been finalized, "
192 "define OPENVDB_USE_FUTURE_ABI_10 to suppress this message"))
193 #endif
194 #else
195 #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
196 #endif
197 #endif
198
199 // If using an OPENVDB_ABI_VERSION_NUMBER that has been deprecated, issue a message
200 // directive. This can be suppressed by defining OPENVDB_USE_DEPRECATED_ABI_<VERSION>.
201 // Note that, whilst the VDB CMake does not allow this option to be hit,
202 // it exists to propagate this message to downstream targets
203 #ifndef OPENVDB_USE_DEPRECATED_ABI_7
204 #if OPENVDB_ABI_VERSION_NUMBER == 7
205 PRAGMA(message("NOTE: ABI = 7 is deprecated, define OPENVDB_USE_DEPRECATED_ABI_7 "
206 "to suppress this message"))
207 #endif
208 #endif
209 #ifndef OPENVDB_USE_DEPRECATED_ABI_8
210 #if OPENVDB_ABI_VERSION_NUMBER == 8
211 PRAGMA(message("NOTE: ABI = 8 is deprecated, define OPENVDB_USE_DEPRECATED_ABI_8 "
212 "to suppress this message"))
213 #endif
214 #endif
215
216 /// By default, the @b OPENVDB_REQUIRE_VERSION_NAME macro is undefined, and
217 /// symbols from the version namespace are promoted to the top-level namespace
218 /// so that, for example, @b openvdb::v5_0::io::File can be referred to
219 /// simply as @b openvdb::io::File.
220 ///
221 /// When @b OPENVDB_REQUIRE_VERSION_NAME is defined, symbols must be
222 /// fully namespace-qualified.
223 /// @hideinitializer
224 #ifdef OPENVDB_REQUIRE_VERSION_NAME
225 #define OPENVDB_USE_VERSION_NAMESPACE
226 #else
227 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
228 // is recognized as a namespace name.
229 #define OPENVDB_USE_VERSION_NAMESPACE \
230 namespace OPENVDB_VERSION_NAME {} \
231 using namespace OPENVDB_VERSION_NAME;
232 #endif
233
234
235 namespace openvdb {
236 OPENVDB_USE_VERSION_NAMESPACE
237 namespace OPENVDB_VERSION_NAME {
238
239 /// @brief The magic number is stored in the first four bytes of every VDB file.
240 /// @details This can be used to quickly test whether we have a valid file or not.
241 const int32_t OPENVDB_MAGIC = 0x56444220;
242
243 /// Library major, minor and patch version numbers
244 /// @hideinitializer
245 const uint32_t
246 OPENVDB_LIBRARY_MAJOR_VERSION = OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER,
247 OPENVDB_LIBRARY_MINOR_VERSION = OPENVDB_LIBRARY_MINOR_VERSION_NUMBER,
248 OPENVDB_LIBRARY_PATCH_VERSION = OPENVDB_LIBRARY_PATCH_VERSION_NUMBER;
249 /// Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
250 /// @hideinitializer
251 const uint32_t OPENVDB_LIBRARY_VERSION = OPENVDB_LIBRARY_VERSION_NUMBER;
252 /// ABI version number
253 /// @hideinitializer
254 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
255
256 /// @brief The current version number of the VDB file format
257 /// @details This can be used to enable various backwards compatibility switches
258 /// or to reject files that cannot be read.
259 const uint32_t OPENVDB_FILE_VERSION = 224;
260
261 /// Notable file format version numbers
262 enum {
263 OPENVDB_FILE_VERSION_ROOTNODE_MAP = 213,
264 OPENVDB_FILE_VERSION_INTERNALNODE_COMPRESSION = 214,
265 OPENVDB_FILE_VERSION_SIMPLIFIED_GRID_TYPENAME = 215,
266 OPENVDB_FILE_VERSION_GRID_INSTANCING = 216,
267 OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION = 217,
268 OPENVDB_FILE_VERSION_BOOST_UUID = 218,
269 OPENVDB_FILE_VERSION_NO_GRIDMAP = 219,
270 OPENVDB_FILE_VERSION_NEW_TRANSFORM = 219,
271 OPENVDB_FILE_VERSION_SELECTIVE_COMPRESSION = 220,
272 OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX = 221,
273 OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION = 222,
274 OPENVDB_FILE_VERSION_BLOSC_COMPRESSION = 223,
275 OPENVDB_FILE_VERSION_POINT_INDEX_GRID = 223,
276 OPENVDB_FILE_VERSION_MULTIPASS_IO = 224
277 };
278
279
280 /// Return a library version number string of the form "<major>.<minor>.<patch>".
281 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
282 /// Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
283 inline constexpr const char* getLibraryAbiVersionString() {
284 return OPENVDB_LIBRARY_ABI_VERSION_STRING;
285 }
286
287
288 struct VersionId {
289 uint32_t first, second;
290
1/2
✓ Branch 0 taken 127 times.
✗ Branch 1 not taken.
127 VersionId(): first(0), second(0) {}
291
4/8
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
5 VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
292 };
293
294 } // namespace OPENVDB_VERSION_NAME
295 } // namespace openvdb
296
297 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
298