OpenVDB  2.0.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_0
46 
51 #ifdef OPENVDB_REQUIRE_VERSION_NAME
52 #define OPENVDB_USE_VERSION_NAMESPACE
53 #else
54 #define OPENVDB_USE_VERSION_NAMESPACE \
57  namespace OPENVDB_VERSION_NAME {} \
58  using namespace OPENVDB_VERSION_NAME;
59 #endif
60 
61 
62 namespace openvdb {
64 namespace OPENVDB_VERSION_NAME {
65 
68 const int32_t OPENVDB_MAGIC = 0x56444220;
69 
70 const uint32_t
74 
78 const uint32_t OPENVDB_FILE_VERSION = 222;
79 
81 enum {
93 };
94 
95 
96 struct VersionId { uint32_t first, second; VersionId(): first(0), second(0) {} };
97 
98 namespace io {
100 OPENVDB_API uint32_t getFormatVersion(std::istream&);
105 OPENVDB_API std::string getVersion(std::istream&);
106 // Associate the current file format and library version numbers with the given input stream.
107 OPENVDB_API void setCurrentVersion(std::istream&);
108 // Associate specific file format and library version numbers with the given stream.
109 OPENVDB_API void setVersion(std::ios_base&, const VersionId& libraryVersion, uint32_t fileVersion);
110 // Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK, etc.)
111 // specifying whether and how input data is compressed or output data should be compressed.
112 OPENVDB_API uint32_t getDataCompression(std::ios_base&);
113 // Associate with the given stream a bitwise OR of compression option flags (COMPRESS_ZIP,
114 // COMPRESS_ACTIVE_MASK, etc.) specifying whether and how input data is compressed
115 // or output data should be compressed.
116 OPENVDB_API void setDataCompression(std::ios_base&, uint32_t compressionFlags);
117 // Return the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid
118 // currently being read from or written to the given stream.
119 OPENVDB_API uint32_t getGridClass(std::ios_base&);
120 // brief Associate with the given stream the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.)
121 // of the grid currently being read or written.
122 OPENVDB_API void setGridClass(std::ios_base&, uint32_t);
123 // Return a pointer to the background value of the grid currently being
124 // read from or written to the given stream.
125 OPENVDB_API const void* getGridBackgroundValuePtr(std::ios_base&);
126 // Specify (a pointer to) the background value of the grid currently being
127 // read from or written to the given stream.
128 // The pointer must remain valid until the entire grid has been read or written.
129 OPENVDB_API void setGridBackgroundValuePtr(std::ios_base&, const void* background);
130 } // namespace io
131 
132 } // namespace OPENVDB_VERSION_NAME
133 } // namespace openvdb
134 
135 #endif // OPENVDB_VERSION_HAS_BEEN_INCLUDED
136 
137 // Copyright (c) 2012-2013 DreamWorks Animation LLC
138 // All rights reserved. This software is distributed under the
139 // 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:162
const uint32_t OPENVDB_FILE_VERSION
The current version number of the VDB file format.
Definition: version.h:78
const int32_t OPENVDB_MAGIC
The magic number is stored in the first four bytes of every VDB file.
Definition: version.h:68
OPENVDB_IMPORT VersionId getLibraryVersion(std::istream &)
Return the (major, minor) library version number associated with the given input stream.
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 void setGridClass(std::ios_base &, uint32_t)
Associate with the given stream the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently ...
OPENVDB_IMPORT void setCurrentVersion(std::istream &)
Associate the current file format and library version numbers with the given input stream...
const uint32_t OPENVDB_LIBRARY_MAJOR_VERSION
Definition: version.h:71
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.
OPENVDB_IMPORT std::string getVersion(std::istream &)
Return a string of the form &quot;&lt;major&gt;.&lt;minor&gt;/&lt;format&gt;&quot;, giving the library and file format version nu...
OPENVDB_IMPORT uint32_t getFormatVersion(std::istream &)
Return the file format version number associated with the given input stream.
#define OPENVDB_VERSION_NAME
Definition: version.h:45
const uint32_t OPENVDB_LIBRARY_PATCH_VERSION
Definition: version.h:73
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...
const uint32_t OPENVDB_LIBRARY_MINOR_VERSION
Definition: version.h:72
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 uint32_t getGridClass(std::ios_base &)
Return the class (GRID_LEVEL_SET, GRID_UNKNOWN, etc.) of the grid currently being read from or writte...
VersionId()
Definition: version.h:96
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:56
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...
Definition: version.h:96