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

Grid archive associated with arbitrary input and output streams (not necessarily files) More...

#include <Stream.h>

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

Public Member Functions

 Stream (std::istream &, bool delayLoad=true)
 Read grids from an input stream. More...
 
 Stream ()
 Construct an archive for stream output. More...
 
 Stream (std::ostream &)
 Construct an archive for output to the given stream. More...
 
 Stream (const Stream &)
 
Streamoperator= (const Stream &)
 
 ~Stream () override
 
Archive::Ptr copy () const override
 Return a copy of this archive. More...
 
MetaMap::Ptr getMetadata () const
 Return the file-level metadata in a newly created MetaMap. More...
 
GridPtrVecPtr getGrids ()
 Return pointers to the grids that were read from the input stream. More...
 
void write (const GridCPtrVec &, const MetaMap &=MetaMap()) const override
 Write the grids in the given container to this archive's output stream. More...
 
template<typename GridPtrContainerT >
void write (const GridPtrContainerT &, const MetaMap &=MetaMap()) const
 Write the grids in the given container to this archive's output stream. More...
 
- Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
 Archive ()
 
 Archive (const Archive &)=default
 
Archiveoperator= (const Archive &)=default
 
virtual ~Archive ()
 
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...
 

Additional Inherited Members

- Public Types inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
using Ptr = SharedPtr< Archive >
 
using ConstPtr = SharedPtr< const Archive >
 
- Static Public Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
static bool hasBloscCompression ()
 Return true if the OpenVDB library includes support for the Blosc compressor. More...
 
static bool isDelayedLoadingEnabled ()
 Return true if delayed loading is enabled. More...
 
- Static Public Attributes inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
static const uint32_t DEFAULT_COMPRESSION_FLAGS
 
- Protected Types inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
using NamedGridMap = std::map< Name, GridBase::Ptr >
 
- Protected Member Functions inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
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 inherited from openvdb::OPENVDB_VERSION_NAME::io::Archive
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...
 

Detailed Description

Grid archive associated with arbitrary input and output streams (not necessarily files)

Definition at line 48 of file Stream.h.

Constructor & Destructor Documentation

openvdb::OPENVDB_VERSION_NAME::io::Stream::Stream ( std::istream &  ,
bool  delayLoad = true 
)
explicit

Read grids from an input stream.

If delayLoad is true, map the contents of the input stream into memory and enable delayed loading of grids.

Note
Define the environment variable OPENVDB_DISABLE_DELAYED_LOAD to disable delayed loading unconditionally.
openvdb::OPENVDB_VERSION_NAME::io::Stream::Stream ( )

Construct an archive for stream output.

openvdb::OPENVDB_VERSION_NAME::io::Stream::Stream ( std::ostream &  )
explicit

Construct an archive for output to the given stream.

openvdb::OPENVDB_VERSION_NAME::io::Stream::Stream ( const Stream )
openvdb::OPENVDB_VERSION_NAME::io::Stream::~Stream ( )
override

Member Function Documentation

Archive::Ptr openvdb::OPENVDB_VERSION_NAME::io::Stream::copy ( ) const
overridevirtual

Return a copy of this archive.

Reimplemented from openvdb::OPENVDB_VERSION_NAME::io::Archive.

GridPtrVecPtr openvdb::OPENVDB_VERSION_NAME::io::Stream::getGrids ( )

Return pointers to the grids that were read from the input stream.

MetaMap::Ptr openvdb::OPENVDB_VERSION_NAME::io::Stream::getMetadata ( ) const

Return the file-level metadata in a newly created MetaMap.

Stream& openvdb::OPENVDB_VERSION_NAME::io::Stream::operator= ( const Stream )
void openvdb::OPENVDB_VERSION_NAME::io::Stream::write ( const GridCPtrVec ,
const MetaMap = MetaMap() 
) const
overridevirtual

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

Exceptions
ValueErrorif this archive was constructed without specifying an output stream.

Reimplemented from openvdb::OPENVDB_VERSION_NAME::io::Archive.

template<typename GridPtrContainerT >
void openvdb::OPENVDB_VERSION_NAME::io::Stream::write ( const GridPtrContainerT &  container,
const MetaMap metadata = MetaMap() 
) const
inline

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

Exceptions
ValueErrorif this archive was constructed without specifying an output stream.

Definition at line 105 of file Stream.h.


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