OpenVDB  6.1.0
version.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2019 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 1
78 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
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 an error
99 // directive. This can be optionally suppressed by defining OPENVDB_USE_DEPRECATED_ABI.
100 #ifndef OPENVDB_USE_DEPRECATED_ABI
101  #if OPENVDB_ABI_VERSION_NUMBER <= 3
102  #error ABI <= 3 is deprecated, define OPENVDB_USE_DEPRECATED_ABI to suppress this error
103  #endif
104 #endif
105 
106 #if OPENVDB_ABI_VERSION_NUMBER == OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
107  #define OPENVDB_VERSION_NAME \
126  OPENVDB_PREPROC_CONCAT(v, \
127  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
128  OPENVDB_PREPROC_CONCAT(_, OPENVDB_LIBRARY_MINOR_VERSION_NUMBER)))
129 #else
130  // This duplication of code is necessary to avoid issues with recursive macro expansion.
131  #define OPENVDB_VERSION_NAME \
132  OPENVDB_PREPROC_CONCAT(v, \
133  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER, \
134  OPENVDB_PREPROC_CONCAT(_, \
135  OPENVDB_PREPROC_CONCAT(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER, \
136  OPENVDB_PREPROC_CONCAT(abi, OPENVDB_ABI_VERSION_NUMBER)))))
137 #endif
138 
144 #define OPENVDB_LIBRARY_VERSION_STRING \
145  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER) "." \
146  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_MINOR_VERSION_NUMBER) "." \
147  OPENVDB_PREPROC_STRINGIFY(OPENVDB_LIBRARY_PATCH_VERSION_NUMBER)
148 
154 #define OPENVDB_LIBRARY_ABI_VERSION_STRING \
155  OPENVDB_LIBRARY_VERSION_STRING "abi" OPENVDB_PREPROC_STRINGIFY(OPENVDB_ABI_VERSION_NUMBER)
156 
158 #define OPENVDB_LIBRARY_VERSION_NUMBER \
159  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
160  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
161  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
162 
163 
172 #ifdef OPENVDB_REQUIRE_VERSION_NAME
173 #define OPENVDB_USE_VERSION_NAMESPACE
174 #else
175 // The empty namespace clause below ensures that OPENVDB_VERSION_NAME
176 // is recognized as a namespace name.
177 #define OPENVDB_USE_VERSION_NAMESPACE \
178  namespace OPENVDB_VERSION_NAME {} \
179  using namespace OPENVDB_VERSION_NAME;
180 #endif
181 
182 
183 namespace openvdb {
185 namespace OPENVDB_VERSION_NAME {
186 
189 const int32_t OPENVDB_MAGIC = 0x56444220;
190 
191 // Library major, minor and patch version numbers
192 const uint32_t
198 // ABI version number
199 const uint32_t OPENVDB_ABI_VERSION = OPENVDB_ABI_VERSION_NUMBER;
200 
204 const uint32_t OPENVDB_FILE_VERSION = 224;
205 
207 enum {
222 };
223 
224 
226 inline constexpr const char* getLibraryVersionString() { return OPENVDB_LIBRARY_VERSION_STRING; }
228 inline constexpr const char* getLibraryAbiVersionString() {
230 }
231 
232 
233 struct VersionId {
234  uint32_t first, second;
235  VersionId(): first(0), second(0) {}
236  VersionId(uint32_t major, uint32_t minor): first(major), second(minor) {}
237 };
238 
239 } // namespace OPENVDB_VERSION_NAME
240 } // namespace openvdb
241 
242 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
243 
244 // Copyright (c) 2012-2019 DreamWorks Animation LLC
245 // All rights reserved. This software is distributed under the
246 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:189
#define OPENVDB_LIBRARY_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:144
Definition: version.h:233
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:204
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:197
VersionId()
Definition: version.h:235
constexpr const char * getLibraryAbiVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:228
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:125
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:195
constexpr const char * getLibraryVersionString()
Return a library version number string of the form "<major>.<minor>.<patch>".
Definition: version.h:226
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:158
#define OPENVDB_LIBRARY_ABI_VERSION_STRING
Library version number string of the form "<major>.<minor>.<patch>abi<abi>".
Definition: version.h:154
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:193
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:194
uint32_t second
Definition: version.h:234
VersionId(uint32_t major, uint32_t minor)
Definition: version.h:236
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:76
const uint32_t OPENVDB_ABI_VERSION
Definition: version.h:199
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:177
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:77
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:78