HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::io::Archive Class Reference

Grid serializer/unserializer. More...

#include <Archive.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::io::Archive:

Public Types

using Ptr = SharedPtr< Archive >
 
using ConstPtr = SharedPtr< const Archive >
 

Public Member Functions

 Archive ()
 
 Archive (const Archive &)=default
 
Archiveoperator= (const Archive &)=default
 
virtual ~Archive ()
 
virtual Ptr copy () const
 Return a copy of this archive. More...
 
std::string getUniqueTag () const
 Return the UUID that was most recently written (or read, if no UUID has been written yet). More...
 
bool isIdentical (const std::string &uuidStr) const
 Return true if the given UUID matches this archive's UUID. More...
 
uint32_t fileVersion () const
 Return the file format version number of the input stream. More...
 
VersionId libraryVersion () const
 Return the (major, minor) version number of the library that was used to write the input stream. More...
 
std::string version () const
 Return a string of the form "<major>.<minor>/<format>", giving the library and file format version numbers associated with the input stream. More...
 
bool isInstancingEnabled () const
 Return true if trees shared by multiple grids are written out only once, false if they are written out once per grid. More...
 
void setInstancingEnabled (bool b)
 Specify whether trees shared by multiple grids should be written out only once (true) or once per grid (false). More...
 
uint32_t compression () const
 Return a bit mask specifying compression options for the data stream. More...
 
void setCompression (uint32_t c)
 Specify whether and how the data stream should be compressed. More...
 
bool isGridStatsMetadataEnabled () const
 Return true if grid statistics (active voxel count and bounding box, etc.) are computed and written as grid metadata. More...
 
void setGridStatsMetadataEnabled (bool b)
 Specify whether grid statistics (active voxel count and bounding box, etc.) should be computed and written as grid metadata. More...
 
virtual void write (const GridCPtrVec &, const MetaMap &=MetaMap()) const
 Write the grids in the given container to this archive's output stream. More...
 

Static Public Member Functions

static bool hasBloscCompression ()
 Return true if the OpenVDB library includes support for the Blosc compressor. More...
 
static bool hasZLibCompression ()
 Return true if the OpenVDB library includes support for the ZLib compressor. More...
 
static bool isDelayedLoadingEnabled ()
 Return true if delayed loading is enabled. More...
 

Static Public Attributes

static const uint32_t DEFAULT_COMPRESSION_FLAGS
 

Protected Types

using NamedGridMap = std::map< Name, GridBase::Ptr >
 

Protected Member Functions

bool inputHasGridOffsets () const
 Return true if the input stream contains grid offsets that allow for random access or partial reading. More...
 
void setInputHasGridOffsets (bool b)
 
void setFormatVersion (std::istream &)
 Tag the given input stream with the input file format version number. More...
 
void setLibraryVersion (std::istream &)
 Tag the given input stream with the version number of the library with which the input stream was created. More...
 
void setDataCompression (std::istream &)
 Tag the given input stream with flags indicating whether the input stream contains compressed data and how it is compressed. More...
 
void setGridCompression (std::ostream &, const GridBase &) const
 Tag an output stream with flags specifying only those compression options that are applicable to the given grid. More...
 
void connectInstance (const GridDescriptor &, const NamedGridMap &) const
 If the grid represented by the given grid descriptor is an instance, connect it with its instance parent. More...
 
void writeGrid (GridDescriptor &, GridBase::ConstPtr, std::ostream &, bool seekable) const
 
void writeGridInstance (GridDescriptor &, GridBase::ConstPtr, std::ostream &, bool seekable) const
 
bool readHeader (std::istream &)
 Read the magic number, version numbers, UUID, etc. from the given input stream. More...
 
void writeHeader (std::ostream &, bool seekable) const
 Write the magic number, version numbers, UUID, etc. to the given output stream. More...
 
void write (std::ostream &, const GridPtrVec &, bool seekable, const MetaMap &=MetaMap()) const
 Write the given grids to an output stream. More...
 
void write (std::ostream &, const GridCPtrVec &, bool seekable, const MetaMap &=MetaMap()) const
 Write the given grids to an output stream. More...
 

Static Protected Member Functions

static void readGridCompression (std::istream &)
 Read in the compression flags for a grid and tag the given input stream with those flags. More...
 
static int32_t readGridCount (std::istream &)
 Read in and return the number of grids on the input stream. More...
 
static void readGrid (GridBase::Ptr, const GridDescriptor &, std::istream &)
 Populate the given grid from the input stream. More...
 
static void readGrid (GridBase::Ptr, const GridDescriptor &, std::istream &, const BBoxd &)
 Populate the given grid from the input stream, but only where it intersects the given world-space bounding box. More...
 
static void readGrid (GridBase::Ptr, const GridDescriptor &, std::istream &, const CoordBBox &)
 Populate the given grid from the input stream, but only where it intersects the given index-space bounding box. More...
 

Friends

class ::TestFile
 

Detailed Description

Grid serializer/unserializer.

Definition at line 31 of file Archive.h.

Member Typedef Documentation

Definition at line 143 of file Archive.h.

Constructor & Destructor Documentation

openvdb::OPENVDB_VERSION_NAME::io::Archive::Archive ( )
openvdb::OPENVDB_VERSION_NAME::io::Archive::Archive ( const Archive )
default
virtual openvdb::OPENVDB_VERSION_NAME::io::Archive::~Archive ( )
virtual

Member Function Documentation

uint32_t openvdb::OPENVDB_VERSION_NAME::io::Archive::compression ( ) const
inline

Return a bit mask specifying compression options for the data stream.

Definition at line 77 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::connectInstance ( const GridDescriptor ,
const NamedGridMap  
) const
protected

If the grid represented by the given grid descriptor is an instance, connect it with its instance parent.

virtual Ptr openvdb::OPENVDB_VERSION_NAME::io::Archive::copy ( ) const
virtual

Return a copy of this archive.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::io::File, and openvdb::OPENVDB_VERSION_NAME::io::Stream.

uint32_t openvdb::OPENVDB_VERSION_NAME::io::Archive::fileVersion ( ) const
inline

Return the file format version number of the input stream.

Definition at line 54 of file Archive.h.

std::string openvdb::OPENVDB_VERSION_NAME::io::Archive::getUniqueTag ( ) const

Return the UUID that was most recently written (or read, if no UUID has been written yet).

static bool openvdb::OPENVDB_VERSION_NAME::io::Archive::hasBloscCompression ( )
static

Return true if the OpenVDB library includes support for the Blosc compressor.

static bool openvdb::OPENVDB_VERSION_NAME::io::Archive::hasZLibCompression ( )
static

Return true if the OpenVDB library includes support for the ZLib compressor.

bool openvdb::OPENVDB_VERSION_NAME::io::Archive::inputHasGridOffsets ( ) const
inlineprotected

Return true if the input stream contains grid offsets that allow for random access or partial reading.

Definition at line 104 of file Archive.h.

static bool openvdb::OPENVDB_VERSION_NAME::io::Archive::isDelayedLoadingEnabled ( )
static

Return true if delayed loading is enabled.

If enabled, delayed loading can be disabled for individual files, but not vice-versa.

Note
Define the environment variable OPENVDB_DISABLE_DELAYED_LOAD to disable delayed loading unconditionally.
bool openvdb::OPENVDB_VERSION_NAME::io::Archive::isGridStatsMetadataEnabled ( ) const
inline

Return true if grid statistics (active voxel count and bounding box, etc.) are computed and written as grid metadata.

Definition at line 86 of file Archive.h.

bool openvdb::OPENVDB_VERSION_NAME::io::Archive::isIdentical ( const std::string uuidStr) const

Return true if the given UUID matches this archive's UUID.

bool openvdb::OPENVDB_VERSION_NAME::io::Archive::isInstancingEnabled ( ) const
inline

Return true if trees shared by multiple grids are written out only once, false if they are written out once per grid.

Definition at line 64 of file Archive.h.

VersionId openvdb::OPENVDB_VERSION_NAME::io::Archive::libraryVersion ( ) const
inline

Return the (major, minor) version number of the library that was used to write the input stream.

Definition at line 57 of file Archive.h.

Archive& openvdb::OPENVDB_VERSION_NAME::io::Archive::operator= ( const Archive )
default
static void openvdb::OPENVDB_VERSION_NAME::io::Archive::readGrid ( GridBase::Ptr  ,
const GridDescriptor ,
std::istream &   
)
staticprotected

Populate the given grid from the input stream.

static void openvdb::OPENVDB_VERSION_NAME::io::Archive::readGrid ( GridBase::Ptr  ,
const GridDescriptor ,
std::istream &  ,
const BBoxd  
)
staticprotected

Populate the given grid from the input stream, but only where it intersects the given world-space bounding box.

static void openvdb::OPENVDB_VERSION_NAME::io::Archive::readGrid ( GridBase::Ptr  ,
const GridDescriptor ,
std::istream &  ,
const CoordBBox &   
)
staticprotected

Populate the given grid from the input stream, but only where it intersects the given index-space bounding box.

static void openvdb::OPENVDB_VERSION_NAME::io::Archive::readGridCompression ( std::istream &  )
staticprotected

Read in the compression flags for a grid and tag the given input stream with those flags.

static int32_t openvdb::OPENVDB_VERSION_NAME::io::Archive::readGridCount ( std::istream &  )
staticprotected

Read in and return the number of grids on the input stream.

bool openvdb::OPENVDB_VERSION_NAME::io::Archive::readHeader ( std::istream &  )
protected

Read the magic number, version numbers, UUID, etc. from the given input stream.

Returns
true if the input UUID differs from the previously-read UUID.
void openvdb::OPENVDB_VERSION_NAME::io::Archive::setCompression ( uint32_t  c)
inline

Specify whether and how the data stream should be compressed.

Parameters
cbitwise OR (e.g., COMPRESS_ZIP | COMPRESS_ACTIVE_MASK) of compression option flags (see Compression.h for the available flags)
Note
Not all combinations of compression options are supported.

Definition at line 82 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setDataCompression ( std::istream &  )
protected

Tag the given input stream with flags indicating whether the input stream contains compressed data and how it is compressed.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setFormatVersion ( std::istream &  )
protected

Tag the given input stream with the input file format version number.

The tag can be retrieved with getFormatVersion().

See Also
getFormatVersion()
void openvdb::OPENVDB_VERSION_NAME::io::Archive::setGridCompression ( std::ostream &  ,
const GridBase  
) const
protected

Tag an output stream with flags specifying only those compression options that are applicable to the given grid.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setGridStatsMetadataEnabled ( bool  b)
inline

Specify whether grid statistics (active voxel count and bounding box, etc.) should be computed and written as grid metadata.

Definition at line 89 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setInputHasGridOffsets ( bool  b)
inlineprotected

Definition at line 105 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setInstancingEnabled ( bool  b)
inline

Specify whether trees shared by multiple grids should be written out only once (true) or once per grid (false).

Note
Instancing is enabled by default.

Definition at line 68 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::setLibraryVersion ( std::istream &  )
protected

Tag the given input stream with the version number of the library with which the input stream was created.

The tag can be retrieved with getLibraryVersion().

See Also
getLibraryVersion()
std::string openvdb::OPENVDB_VERSION_NAME::io::Archive::version ( ) const

Return a string of the form "<major>.<minor>/<format>", giving the library and file format version numbers associated with the input stream.

virtual void openvdb::OPENVDB_VERSION_NAME::io::Archive::write ( const GridCPtrVec ,
const MetaMap = MetaMap() 
) const
inlinevirtual

Write the grids in the given container to this archive's output stream.

Reimplemented in openvdb::OPENVDB_VERSION_NAME::io::File, and openvdb::OPENVDB_VERSION_NAME::io::Stream.

Definition at line 92 of file Archive.h.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::write ( std::ostream &  ,
const GridPtrVec ,
bool  seekable,
const MetaMap = MetaMap() 
) const
protected

Write the given grids to an output stream.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::write ( std::ostream &  ,
const GridCPtrVec ,
bool  seekable,
const MetaMap = MetaMap() 
) const
protected

Write the given grids to an output stream.

void openvdb::OPENVDB_VERSION_NAME::io::Archive::writeGrid ( GridDescriptor ,
GridBase::ConstPtr  ,
std::ostream &  ,
bool  seekable 
) const
protected

Write the given grid descriptor and grid to an output stream and update the GridDescriptor offsets.

Parameters
seekableif true, the output stream supports seek operations
void openvdb::OPENVDB_VERSION_NAME::io::Archive::writeGridInstance ( GridDescriptor ,
GridBase::ConstPtr  ,
std::ostream &  ,
bool  seekable 
) const
protected

Write the given grid descriptor and grid metadata to an output stream and update the GridDescriptor offsets, but don't write the grid's tree, since it is shared with another grid.

Parameters
seekableif true, the output stream supports seek operations
void openvdb::OPENVDB_VERSION_NAME::io::Archive::writeHeader ( std::ostream &  ,
bool  seekable 
) const
protected

Write the magic number, version numbers, UUID, etc. to the given output stream.

Parameters
seekableif true, the output stream supports seek operations
Todo:
This method should not be const since it actually redefines the UUID!

Friends And Related Function Documentation

friend class ::TestFile
friend

Definition at line 175 of file Archive.h.

Member Data Documentation

const uint32_t openvdb::OPENVDB_VERSION_NAME::io::Archive::DEFAULT_COMPRESSION_FLAGS
static

Definition at line 37 of file Archive.h.


The documentation for this class was generated from the following file: