OpenVDB  6.2.1
version.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 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 
74 
75 // Library major, minor and patch version numbers
76 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 6
77 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 2
78 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 1
79 
80 // If OPENVDB_ABI_VERSION_NUMBER is already defined (e.g., via -DOPENVDB_ABI_VERSION_NUMBER=N)
81 // use that ABI version. Otherwise, use this library version's default ABI.
82 #ifdef OPENVDB_ABI_VERSION_NUMBER
83  #if OPENVDB_ABI_VERSION_NUMBER > OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
84  #error expected OPENVDB_ABI_VERSION_NUMBER <= OPENVDB_LIBRARY_MAJOR VERSION_NUMBER
85  #endif
86 #else
87  // Older versions of the library used the macros OPENVDB_2_ABI_COMPATIBLE
88  // and OPENVDB_3_ABI_COMPATIBLE. For now, continue to support them.
89  #if defined OPENVDB_2_ABI_COMPATIBLE
90  #define OPENVDB_ABI_VERSION_NUMBER 2
91  #elif defined OPENVDB_3_ABI_COMPATIBLE
92  #define OPENVDB_ABI_VERSION_NUMBER 3
93  #else
94  #define OPENVDB_ABI_VERSION_NUMBER OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
95  #endif
96 #endif
97 
98 // If using an OPENVDB_ABI_VERSION_NUMBER that has been deprecated, issue a message
99 // directive. Note that an error is also set in openvdb.cc which enforces stricter
100 // behavior during compilation of the library. Both can be optionally suppressed
101 // by defining OPENVDB_USE_DEPRECATED_ABI.
102 #ifndef OPENVDB_USE_DEPRECATED_ABI
103  #if OPENVDB_ABI_VERSION_NUMBER <= 3
104  PRAGMA(message("NOTE: ABI <= 3 is deprecated, define OPENVDB_USE_DEPRECATED_ABI "
105  "to suppress this message"))
106  #endif
107 #endif
108 
109 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
110  #define OPENVDB_VERSION_NAME \
129  OPENVDB_PREPROC_CONCAT(v, \
130  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
131  OPENVDB_PREPROC_CONCAT(_, OPENVDB_LIBRARY_MINOR_VERSION_NUMBER)))
132 #else
133  // This duplication of code is necessary to avoid issues with recursive macro expansion.
134  #define OPENVDB_VERSION_NAME \
135  OPENVDB_PREPROC_CONCAT(v, \
136  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
137  OPENVDB_PREPROC_CONCAT(_, \
138  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER, \
139  OPENVDB_PREPROC_CONCAT(abi, OPENVDB_ABI_VERSION_NUMBER)))))
140 #endif
141 
147 #define OPENVDB_LIBRARY_VERSION_STRING \
148  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER) "." \
149  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER) "." \
150  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_PATCH_VERSION_NUMBER)
151 
157 #define OPENVDB_LIBRARY_ABI_VERSION_STRING \
158  OPENVDB_LIBRARY_VERSION_STRING "abi" OPENVDB_PREPROC_STRINGIFY(OPENVDB_ABI_VERSION_NUMBER)
159 
161 #define OPENVDB_LIBRARY_VERSION_NUMBER \
162  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
163  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
164  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
165 
166 
175 #ifdef OPENVDB_REQUIRE_VERSION_NAME
176 #define OPENVDB_USE_VERSION_NAMESPACE
177 #else
178 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
179 // is recognized as a namespace name.
180 #define OPENVDB_USE_VERSION_NAMESPACE \
181  namespace OPENVDB_VERSION_NAME {} \
182  using namespace OPENVDB_VERSION_NAME;
183 #endif
184 
185 
186 namespace openvdb {
188 namespace OPENVDB_VERSION_NAME {
189 
192 const int32_t OPENVDB_MAGIC = 0x56444220;
193 
194 // Library major, minor and patch version numbers
195 const uint32_t
201 // ABI version number
202 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
203 
207 const uint32_t OPENVDB_FILE_VERSION = 224;
208 
210 enum {
225 };
226 
227 
229 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
231 inline constexpr const char* getLibraryAbiVersionString() {
233 }
234 
235 
236 struct VersionId {
237  uint32_t first, second;
238  VersionId(): first(0), second(0) {}
239  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
240 };
241 
242 } // namespace OPENVDB_VERSION_NAME
243 } // namespace openvdb
244 
245 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
246 
247 // Copyright (c) DreamWorks Animation LLC
248 // All rights reserved. This software is distributed under the
249 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
VersionId()
Definition: version.h:238
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:231
uint32_t second
Definition: version.h:237
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:207
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:147
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:198
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:197
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:128
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:239
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:229
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:161
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:157
#define PRAGMA(x)
Definition: Platform.h:38
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:202
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:200
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:76
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:196
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:180
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:192
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:77
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:78
Definition: version.h:236