OpenVDB  8.0.1
version.h
Go to the documentation of this file.
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3 
41 
42 #ifndef OPENVDB_VERSION_HAS_BEEN_INCLUDED
43 #define OPENVDB_VERSION_HAS_BEEN_INCLUDED
44 
45 #include "Platform.h"
46 #include <cstddef> // size_t
47 #include <cstdint> // uint32_t
48 
49 
50 // Library major, minor and patch version numbers
51 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 8
52 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 0
53 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 1
54 
55 // If OPENVDB_ABI_VERSION_NUMBER is already defined (e.g., via -DOPENVDB_ABI_VERSION_NUMBER=N)
56 // use that ABI version. Otherwise, use this library version's default ABI.
57 #ifdef OPENVDB_ABI_VERSION_NUMBER
58  #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
59  #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR VERSION_NUMBER
60  #endif
61 #else
62  #define OPENVDB_ABI_VERSION_NUMBER OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
63 #endif
64 
65 // If using an OPENVDB_ABI_VERSION_NUMBER that has been deprecated, issue a message
66 // directive. Note that an error is also set in openvdb.cc which enforces stricter
67 // behavior during compilation of the library. Both can be optionally suppressed
68 // by defining OPENVDB_USE_DEPRECATED_ABI_<VERSION>.
69 #ifndef OPENVDB_USE_DEPRECATED_ABI_5
70  #if OPENVDB_ABI_VERSION_NUMBER == 5
71  PRAGMA(message("NOTE: ABI = 5 is deprecated, CMake option OPENVDB_USE_DEPRECATED_ABI_5 "
72  "suppresses this message"))
73  #endif
74 #endif
75 #ifndef OPENVDB_USE_DEPRECATED_ABI_6
76  #if OPENVDB_ABI_VERSION_NUMBER == 6
77  PRAGMA(message("NOTE: ABI = 6 is deprecated, CMake option OPENVDB_USE_DEPRECATED_ABI_6 "
78  "suppresses this message"))
79  #endif
80 #endif
81 
82 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
101  #define OPENVDB_VERSION_NAME \
102  OPENVDB_PREPROC_CONCAT(v, \
103  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
104  OPENVDB_PREPROC_CONCAT(_, OPENVDB_LIBRARY_MINOR_VERSION_NUMBER)))
105 #else
106  // This duplication of code is necessary to avoid issues with recursive macro expansion.
107  #define OPENVDB_VERSION_NAME \
108  OPENVDB_PREPROC_CONCAT(v, \
109  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
110  OPENVDB_PREPROC_CONCAT(_, \
111  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER, \
112  OPENVDB_PREPROC_CONCAT(abi, OPENVDB_ABI_VERSION_NUMBER)))))
113 #endif
114 
120 #define OPENVDB_LIBRARY_VERSION_STRING \
121  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER) "." \
122  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER) "." \
123  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_PATCH_VERSION_NUMBER)
124 
130 #define OPENVDB_LIBRARY_ABI_VERSION_STRING \
131  OPENVDB_LIBRARY_VERSION_STRING "abi" OPENVDB_PREPROC_STRINGIFY(OPENVDB_ABI_VERSION_NUMBER)
132 
134 #define OPENVDB_LIBRARY_VERSION_NUMBER \
135  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
136  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
137  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
138 
139 
148 #ifdef OPENVDB_REQUIRE_VERSION_NAME
149 #define OPENVDB_USE_VERSION_NAMESPACE
150 #else
151 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
152 // is recognized as a namespace name.
153 #define OPENVDB_USE_VERSION_NAMESPACE \
154  namespace OPENVDB_VERSION_NAME {} \
155  using namespace OPENVDB_VERSION_NAME;
156 #endif
157 
158 
159 namespace openvdb {
161 namespace OPENVDB_VERSION_NAME {
162 
165 const int32_t OPENVDB_MAGIC = 0x56444220;
166 
167 // Library major, minor and patch version numbers
168 const uint32_t
174 // ABI version number
175 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
176 
180 const uint32_t OPENVDB_FILE_VERSION = 224;
181 
183 enum {
198 };
199 
200 
202 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
204 inline constexpr const char* getLibraryAbiVersionString() {
206 }
207 
208 
209 struct VersionId {
210  uint32_t first, second;
211  VersionId(): first(0), second(0) {}
212  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
213 };
214 
215 } // namespace OPENVDB_VERSION_NAME
216 } // namespace openvdb
217 
218 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
#define PRAGMA(x)
Definition: Platform.h:11
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:175
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:202
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:169
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:180
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:171
@ OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION
Definition: version.h:188
@ OPENVDB_FILE_VERSION_SELECTIVE_COMPRESSION
Definition: version.h:192
@ OPENVDB_FILE_VERSION_GRID_INSTANCING
Definition: version.h:187
@ OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION
Definition: version.h:194
@ OPENVDB_FILE_VERSION_BLOSC_COMPRESSION
Definition: version.h:195
@ OPENVDB_FILE_VERSION_BOOST_UUID
Definition: version.h:189
@ OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX
Definition: version.h:193
@ OPENVDB_FILE_VERSION_INTERNALNODE_COMPRESSION
Definition: version.h:185
@ OPENVDB_FILE_VERSION_SIMPLIFIED_GRID_TYPENAME
Definition: version.h:186
@ OPENVDB_FILE_VERSION_ROOTNODE_MAP
Definition: version.h:184
@ OPENVDB_FILE_VERSION_MULTIPASS_IO
Definition: version.h:197
@ OPENVDB_FILE_VERSION_NO_GRIDMAP
Definition: version.h:190
@ OPENVDB_FILE_VERSION_NEW_TRANSFORM
Definition: version.h:191
@ OPENVDB_FILE_VERSION_POINT_INDEX_GRID
Definition: version.h:196
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:165
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:204
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:170
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:173
Definition: openvdb/Exceptions.h:13
Definition: version.h:209
uint32_t first
Definition: version.h:210
VersionId()
Definition: version.h:211
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:212
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:101
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:130
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:153
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:134
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:120
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:52
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:51
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:53