OpenVDB  2.3.0
version.h
Go to the documentation of this file.
1 //
3 // Copyright (c) 2012-2013 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 
31 #ifndef OPENVDB_VERSION_HAS_BEEN_INCLUDED
32 #define OPENVDB_VERSION_HAS_BEEN_INCLUDED
33 
34 #include "Platform.h"
35 #include <iosfwd> // for std::istream
36 #include <string>
37 
38 
45 #define OPENVDB_VERSION_NAME v2_3
46 
47 // Library major, minor and patch version numbers
48 #define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER 2
49 #define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER 3
50 #define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER 0
51 
53 #define OPENVDB_LIBRARY_VERSION_NUMBER \
54  ((OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER << 24) | \
55  ((OPENVDB_LIBRARY_MINOR_VERSION_NUMBER & 0xFF) << 16) | \
56  (OPENVDB_LIBRARY_PATCH_VERSION_NUMBER & 0xFFFF))
57 
62 #ifdef OPENVDB_REQUIRE_VERSION_NAME
63 #define OPENVDB_USE_VERSION_NAMESPACE
64 #else
65 #define OPENVDB_USE_VERSION_NAMESPACE \
68  namespace OPENVDB_VERSION_NAME {} \
69  using namespace OPENVDB_VERSION_NAME;
70 #endif
71 
72 
73 namespace openvdb {
75 namespace OPENVDB_VERSION_NAME {
76 
79 const int32_t OPENVDB_MAGIC = 0x56444220;
80 
81 // Library major, minor and patch version numbers
82 const uint32_t
88 
92 const uint32_t OPENVDB_FILE_VERSION = 222;
93 
95 enum {
107 };
108 
109 
110 struct VersionId { uint32_t first, second; VersionId(): first(0), second(0) {} };
111 
112 namespace io {
114 OPENVDB_API uint32_t getFormatVersion(std::istream&);
119 OPENVDB_API std::string getVersion(std::istream&);
120 // Associate the current file format and library version numbers with the given input stream.
121 OPENVDB_API void setCurrentVersion(std::istream&);
122 // Associate specific file format and library version numbers with the given stream.
123 OPENVDB_API void setVersion(std::ios_base&, const VersionId& libraryVersion, uint32_t fileVersion);
124 // Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK, etc.)
125 // specifying whether and how input data is compressed or output data should be compressed.
126 OPENVDB_API uint32_t getDataCompression(std::ios_base&);
127 // Associate with the given stream a bitwise OR of compression option flags (COMPRESS_ZIP,
128 // COMPRESS_ACTIVE_MASK, etc.) specifying whether and how input data is compressed
129 // or output data should be compressed.
130 OPENVDB_API void setDataCompression(std::ios_base&, uint32_t compressionFlags);
131 // Return the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid
132 // currently being read from or written to the given stream.
133 OPENVDB_API uint32_t getGridClass(std::ios_base&);
134 // brief Associate with the given stream the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.)
135 // of the grid currently being read or written.
136 OPENVDB_API void setGridClass(std::ios_base&, uint32_t);
137 // Return a pointer to the background value of the grid currently being
138 // read from or written to the given stream.
139 OPENVDB_API const void* getGridBackgroundValuePtr(std::ios_base&);
140 // Specify (a pointer to) the background value of the grid currently being
141 // read from or written to the given stream.
142 // The pointer must remain valid until the entire grid has been read or written.
143 OPENVDB_API void setGridBackgroundValuePtr(std::ios_base&, const void* background);
144 } // namespace io
145 
146 } // namespace OPENVDB_VERSION_NAME
147 } // namespace openvdb
148 
149 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
150 
151 // Copyright (c) 2012-2013 DreamWorks Animation LLC
152 // All rights reserved. This software is distributed under the
153 // Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
#define OPENVDB_API
Helper macros for defining library symbol visibility.
Definition: Platform.h:187
OPENVDB_IMPORT uint32_t getGridClass(std::ios_base &)
Return the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently being read from or writte...
OPENVDB_IMPORT void setVersion(std::ios_base &, const VersionId &libraryVersion, uint32_t fileVersion)
Associate specific file format and library version numbers with the given stream. ...
OPENVDB_IMPORT std::string getVersion(std::istream &)
Return a string of the form "./", giving the library and file format version nu...
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:84
const uint32_t OPENVDB_LIBRARY_VERSION
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:87
OPENVDB_IMPORT VersionId getLibraryVersion(std::istream &)
Return the (major, minor) library version number associated with the given input stream.
#define OPENVDB_VERSION_NAME
Definition: version.h:45
OPENVDB_IMPORT void setGridClass(std::ios_base &, uint32_t)
Associate with the given stream the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently ...
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:92
OPENVDB_IMPORT void setCurrentVersion(std::istream &)
Associate the current file format and library version numbers with the given input stream...
Definition: version.h:110
#define OPENVDB_LIBRARY_VERSION_NUMBER
Library version number as a packed integer ("%02x%02x%04x", major, minor, patch)
Definition: version.h:53
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:79
OPENVDB_IMPORT uint32_t getFormatVersion(std::istream &)
Return the file format version number associated with the given input stream.
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:83
OPENVDB_IMPORT void setDataCompression(std::ios_base &, uint32_t compressionFlags)
Associate with the given stream a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK, etc.) specifying whether and how input data is compressed or output data should be compressed.
OPENVDB_IMPORT const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
#define OPENVDB_LIBRARY_MAJOR_VERSION_NUMBER
Definition: version.h:48
VersionId()
Definition: version.h:110
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:67
#define OPENVDB_LIBRARY_MINOR_VERSION_NUMBER
Definition: version.h:49
OPENVDB_IMPORT void setGridBackgroundValuePtr(std::ios_base &, const void *background)
Specify (a pointer to) the background value of the grid currently being read from or written to the g...
OPENVDB_IMPORT uint32_t getDataCompression(std::ios_base &)
Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK, etc.) specifying whether and how input data is compressed or output data should be compressed.
#define OPENVDB_LIBRARY_PATCH_VERSION_NUMBER
Definition: version.h:50
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:85