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
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:121
uint32_t second
Definition: version.h:211
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:181
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:205
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:174
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:213
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:102
Definition: Exceptions.h:13
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:135
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:131
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:170
#define PRAGMA(x)
Definition: Platform.h:11
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:166
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:171
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:203
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:50
Definition: version.h:210
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:51
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:172
VersionId()
Definition: version.h:212
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:52
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:176