OpenVDB  6.0.0
version.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2018 DreamWorks Animation LLC
4 //
5 // All rights reserved. This software is distributed under the
6 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
7 //
8 // Redistributions of source code must retain the above copyright
9 // and license notice and the following restrictions and disclaimer.
10 //
11 // * Neither the name of DreamWorks Animation nor the names of
12 // its contributors may be used to endorse or promote products derived
13 // from this software without specific prior written permission.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 // IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
27 // LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
28 //
30 
68 
69 #ifndef OPENVDB_VERSION_HAS_BEEN_INCLUDED
70 #define OPENVDB_VERSION_HAS_BEEN_INCLUDED
71 
72 #include "Platform.h"
73 
77 #define OPENVDB_PREPROC_STRINGIFY_(x) #x
78 #define OPENVDB_PREPROC_STRINGIFY(x) OPENVDB_PREPROC_STRINGIFY_(x)
83 
85 #define OPENVDB_PREPROC_CONCAT_(x, y) x ## y
86 #define OPENVDB_PREPROC_CONCAT(x, y) OPENVDB_PREPROC_CONCAT_(x, y)
91 
93 
94 // Library major, minor and patch version numbers
95 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 6
96 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 0
97 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
98 
99 // If OPENVDB_ABI_VERSION_NUMBER is already defined (e.g., via -DOPENVDB_ABI_VERSION_NUMBER=N)
100 // use that ABI version. Otherwise, use this library version's default ABI.
101 #ifdef OPENVDB_ABI_VERSION_NUMBER
102  #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
103  #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR VERSION_NUMBER
104  #endif
105 #else
106  // Older versions of the library used the macros OPENVDB_2_ABI_COMPATIBLE
107  // and OPENVDB_3_ABI_COMPATIBLE. For now, continue to support them.
108  #if defined OPENVDB_2_ABI_COMPATIBLE
109  #define OPENVDB_ABI_VERSION_NUMBER 2
110  #elif defined OPENVDB_3_ABI_COMPATIBLE
111  #define OPENVDB_ABI_VERSION_NUMBER 3
112  #else
113  #define OPENVDB_ABI_VERSION_NUMBER OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
114  #endif
115 #endif
116 
117 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
118  #define OPENVDB_VERSION_NAME \
137  OPENVDB_PREPROC_CONCAT(v, \
138  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
139  OPENVDB_PREPROC_CONCAT(_, OPENVDB_LIBRARY_MINOR_VERSION_NUMBER)))
140 #else
141  // This duplication of code is necessary to avoid issues with recursive macro expansion.
142  #define OPENVDB_VERSION_NAME \
143  OPENVDB_PREPROC_CONCAT(v, \
144  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
145  OPENVDB_PREPROC_CONCAT(_, \
146  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER, \
147  OPENVDB_PREPROC_CONCAT(abi, OPENVDB_ABI_VERSION_NUMBER)))))
148 #endif
149 
155 #define OPENVDB_LIBRARY_VERSION_STRING \
156  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER) "." \
157  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER) "." \
158  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_PATCH_VERSION_NUMBER)
159 
165 #define OPENVDB_LIBRARY_ABI_VERSION_STRING \
166  OPENVDB_LIBRARY_VERSION_STRING "abi" OPENVDB_PREPROC_STRINGIFY(OPENVDB_ABI_VERSION_NUMBER)
167 
169 #define OPENVDB_LIBRARY_VERSION_NUMBER \
170  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
171  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
172  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
173 
174 
183 #ifdef OPENVDB_REQUIRE_VERSION_NAME
184 #define OPENVDB_USE_VERSION_NAMESPACE
185 #else
186 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
187 // is recognized as a namespace name.
188 #define OPENVDB_USE_VERSION_NAMESPACE \
189  namespace OPENVDB_VERSION_NAME {} \
190  using namespace OPENVDB_VERSION_NAME;
191 #endif
192 
193 
194 namespace openvdb {
196 namespace OPENVDB_VERSION_NAME {
197 
200 const int32_t OPENVDB_MAGIC = 0x56444220;
201 
202 // Library major, minor and patch version numbers
203 const uint32_t
209 // ABI version number
210 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
211 
215 const uint32_t OPENVDB_FILE_VERSION = 224;
216 
218 enum {
233 };
234 
235 
237 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
239 inline constexpr const char* getLibraryAbiVersionString() {
241 }
242 
243 
244 struct VersionId {
245  uint32_t first, second;
246  VersionId(): first(0), second(0) {}
247  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
248 };
249 
250 } // namespace OPENVDB_VERSION_NAME
251 } // namespace openvdb
252 
253 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
254 
255 // Copyright (c) 2012-2018 DreamWorks Animation LLC
256 // All rights reserved. This software is distributed under the
257 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:204
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:206
uint32_t second
Definition: version.h:245
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:155
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:210
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:205
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:239
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:200
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:247
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
Definition: Exceptions.h:40
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:169
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:165
Definition: version.h:244
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:237
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:95
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:96
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:215
VersionId()
Definition: version.h:246
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:208
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:97