OpenVDB  7.0.0
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 <cstdint> // uint32_t
47 
48 
49 // Library major, minor and patch version numbers
50 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 7
51 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 0
52 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
53 
54 // If OPENVDB_ABI_VERSION_NUMBER is already defined (e.g., via -DOPENVDB_ABI_VERSION_NUMBER=N)
55 // use that ABI version. Otherwise, use this library version's default ABI.
56 #ifdef OPENVDB_ABI_VERSION_NUMBER
57  #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
58  #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR VERSION_NUMBER
59  #endif
60 #else
61  // Older versions of the library used the macros OPENVDB_2_ABI_COMPATIBLE
62  // and OPENVDB_3_ABI_COMPATIBLE. For now, continue to support them.
63  #if defined OPENVDB_2_ABI_COMPATIBLE
64  #define OPENVDB_ABI_VERSION_NUMBER 2
65  #elif defined OPENVDB_3_ABI_COMPATIBLE
66  #define OPENVDB_ABI_VERSION_NUMBER 3
67  #else
68  #define OPENVDB_ABI_VERSION_NUMBER OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
69  #endif
70 #endif
71 
72 // If using an OPENVDB_ABI_VERSION_NUMBER that has been deprecated, issue a message
73 // directive. Note that an error is also set in openvdb.cc which enforces stricter
74 // behavior during compilation of the library. Both can be optionally suppressed
75 // by defining OPENVDB_USE_DEPRECATED_ABI.
76 #ifndef OPENVDB_USE_DEPRECATED_ABI
77  #if OPENVDB_ABI_VERSION_NUMBER == 4
78  PRAGMA(message("NOTE: ABI = 4 is deprecated, define OPENVDB_USE_DEPRECATED_ABI "
79  "to suppress this message"))
80  #endif
81 #endif
82 
83 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
84  #define OPENVDB_VERSION_NAME \
103  OPENVDB_PREPROC_CONCAT(v, \
104  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
105  OPENVDB_PREPROC_CONCAT(_, OPENVDB_LIBRARY_MINOR_VERSION_NUMBER)))
106 #else
107  // This duplication of code is necessary to avoid issues with recursive macro expansion.
108  #define OPENVDB_VERSION_NAME \
109  OPENVDB_PREPROC_CONCAT(v, \
110  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
111  OPENVDB_PREPROC_CONCAT(_, \
112  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER, \
113  OPENVDB_PREPROC_CONCAT(abi, OPENVDB_ABI_VERSION_NUMBER)))))
114 #endif
115 
121 #define OPENVDB_LIBRARY_VERSION_STRING \
122  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER) "." \
123  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER) "." \
124  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_PATCH_VERSION_NUMBER)
125 
131 #define OPENVDB_LIBRARY_ABI_VERSION_STRING \
132  OPENVDB_LIBRARY_VERSION_STRING "abi" OPENVDB_PREPROC_STRINGIFY(OPENVDB_ABI_VERSION_NUMBER)
133 
135 #define OPENVDB_LIBRARY_VERSION_NUMBER \
136  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
137  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
138  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
139 
140 
149 #ifdef OPENVDB_REQUIRE_VERSION_NAME
150 #define OPENVDB_USE_VERSION_NAMESPACE
151 #else
152 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
153 // is recognized as a namespace name.
154 #define OPENVDB_USE_VERSION_NAMESPACE \
155  namespace OPENVDB_VERSION_NAME {} \
156  using namespace OPENVDB_VERSION_NAME;
157 #endif
158 
159 
160 namespace openvdb {
162 namespace OPENVDB_VERSION_NAME {
163 
166 const int32_t OPENVDB_MAGIC = 0x56444220;
167 
168 // Library major, minor and patch version numbers
169 const uint32_t
175 // ABI version number
176 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
177 
181 const uint32_t OPENVDB_FILE_VERSION = 224;
182 
184 enum {
199 };
200 
201 
203 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
205 inline constexpr const char* getLibraryAbiVersionString() {
207 }
208 
209 
210 struct VersionId {
211  uint32_t first, second;
212  VersionId(): first(0), second(0) {}
213  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
214 };
215 
216 } // namespace OPENVDB_VERSION_NAME
217 } // namespace openvdb
218 
219 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
openvdb::v7_0::OPENVDB_LIBRARY_VERSION
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:174
PRAGMA
#define PRAGMA(x)
Definition: Platform.h:11
OPENVDB_LIBRARY_VERSION_STRING
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:121
OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:52
openvdb::v7_0::OPENVDB_FILE_VERSION_BOOST_UUID
@ OPENVDB_FILE_VERSION_BOOST_UUID
Definition: version.h:190
openvdb::v7_0::OPENVDB_LIBRARY_MAJOR_VERSION
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:170
OPENVDB_LIBRARY_ABI_VERSION_STRING
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:131
openvdb::v7_0::OPENVDB_MAGIC
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:166
openvdb::v7_0::OPENVDB_FILE_VERSION_POINT_INDEX_GRID
@ OPENVDB_FILE_VERSION_POINT_INDEX_GRID
Definition: version.h:197
openvdb::v7_0::OPENVDB_FILE_VERSION_INTERNALNODE_COMPRESSION
@ OPENVDB_FILE_VERSION_INTERNALNODE_COMPRESSION
Definition: version.h:186
openvdb::v7_0::VersionId
Definition: version.h:210
Platform.h
openvdb::v7_0::OPENVDB_LIBRARY_PATCH_VERSION
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:172
openvdb::v7_0::OPENVDB_FILE_VERSION_NEW_TRANSFORM
@ OPENVDB_FILE_VERSION_NEW_TRANSFORM
Definition: version.h:192
openvdb::v7_0::OPENVDB_FILE_VERSION_BLOSC_COMPRESSION
@ OPENVDB_FILE_VERSION_BLOSC_COMPRESSION
Definition: version.h:196
OPENVDB_LIBRARY_VERSION_NUMBER
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:135
openvdb::v7_0::OPENVDB_FILE_VERSION_SIMPLIFIED_GRID_TYPENAME
@ OPENVDB_FILE_VERSION_SIMPLIFIED_GRID_TYPENAME
Definition: version.h:187
openvdb::v7_0::OPENVDB_ABI_VERSION
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:176
openvdb::v7_0::VersionId::VersionId
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:213
openvdb::v7_0::getLibraryVersionString
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:203
openvdb::v7_0::OPENVDB_FILE_VERSION_GRID_INSTANCING
@ OPENVDB_FILE_VERSION_GRID_INSTANCING
Definition: version.h:188
openvdb::v7_0::VersionId::second
uint32_t second
Definition: version.h:211
openvdb::v7_0::OPENVDB_FILE_VERSION_SELECTIVE_COMPRESSION
@ OPENVDB_FILE_VERSION_SELECTIVE_COMPRESSION
Definition: version.h:193
openvdb::v7_0::OPENVDB_FILE_VERSION_ROOTNODE_MAP
@ OPENVDB_FILE_VERSION_ROOTNODE_MAP
Definition: version.h:185
openvdb::v7_0::VersionId::VersionId
VersionId()
Definition: version.h:212
openvdb::v7_0::OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION
@ OPENVDB_FILE_VERSION_NODE_MASK_COMPRESSION
Definition: version.h:195
OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:50
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154
openvdb::v7_0::OPENVDB_LIBRARY_MINOR_VERSION
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:171
openvdb::v7_0::OPENVDB_FILE_VERSION_NO_GRIDMAP
@ OPENVDB_FILE_VERSION_NO_GRIDMAP
Definition: version.h:191
openvdb::v7_0::getLibraryAbiVersionString
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:205
openvdb::v7_0::OPENVDB_FILE_VERSION
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:181
openvdb::v7_0::OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION
@ OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION
Definition: version.h:189
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
Definition: version.h:108
OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:51
openvdb::v7_0::OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX
@ OPENVDB_FILE_VERSION_FLOAT_FRUSTUM_BBOX
Definition: version.h:194
openvdb
Definition: Exceptions.h:13
openvdb::v7_0::OPENVDB_FILE_VERSION_MULTIPASS_IO
@ OPENVDB_FILE_VERSION_MULTIPASS_IO
Definition: version.h:198