OpenVDB
1.1.0
|
Grid archive associated with a file on disk. More...
#include <File.h>
Inherits Archive.
Classes | |
class | NameIterator |
Public Types | |
typedef std::multimap< Name, GridDescriptor > | NameMap |
typedef NameMap::const_iterator | NameMapCIter |
Public Member Functions | |
File (const std::string &filename) | |
~File () | |
const std::string & | filename () const |
bool | open () |
bool | isOpen () const |
Return true if the file has been opened for reading, false otherwise. | |
void | close () |
Close the file once we are done reading from it. | |
bool | hasGrid (const Name &) const |
Return true if a grid of the given name exists in this file. | |
MetaMap::Ptr | getMetadata () const |
Return (in a newly created MetaMap) the file-level metadata. | |
GridPtrVecPtr | getGrids () const |
Read the entire contents of the file and return a list of grid pointers. | |
GridPtrVecPtr | readAllGridMetadata () |
Read just the grid metadata and transforms from the file and return a list of pointers to grids that are empty except for their metadata and transforms. | |
GridBase::Ptr | readGridMetadata (const Name &) |
Read a grid's metadata and transform only. | |
GridBase::ConstPtr | readGridPartial (const Name &) |
Read a grid's metadata, topology, transform, etc., but not any of its leaf node data blocks. | |
GridBase::Ptr | readGrid (const Name &) |
Read an entire grid, including all of its data blocks. | |
template<typename GridPtrContainerT > | |
void | write (const GridPtrContainerT &, const MetaMap &=MetaMap()) const |
Write the grids in the given container to the file whose name was given in the constructor. | |
NameIterator | beginName () const |
NameIterator | endName () const |
template<> | |
void | write (const GridCPtrVec &grids, const MetaMap &metadata) const |
std::string | getUniqueTag () const |
Return the UUID that was most recently written (or read, if no UUID has been written yet). | |
bool | isIdentical (const std::string &uuidStr) const |
Return true if the given UUID matches this archive's UUID. | |
uint32_t | fileVersion () const |
Return the file format version number of the input stream. | |
VersionId | libraryVersion () const |
Return the (major, minor) version number of the library that was used to write the input stream. | |
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. | |
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. | |
void | setInstancingEnabled (bool b) |
Specify whether trees shared by multiple grids should be written out only once (true ) or once per grid (false ). | |
bool | isCompressionEnabled () const |
Return true if the data stream is Zip-compressed. | |
void | setCompressionEnabled (bool) |
Specify whether the data stream should be Zip-compressed. | |
uint32_t | compressionFlags () const |
Return a bit mask specifying compression options for the data stream. | |
void | setCompressionFlags (uint32_t c) |
Specify whether and how the data stream should be compressed. [Mainly for internal use]. | |
bool | isGridStatsMetadataEnabled () const |
Return true if grid statistics (active voxel count and bounding box, etc.) are computed and written as grid metadata. | |
void | setGridStatsMetadataEnabled (bool b) |
Specify whether grid statistics (active voxel count and bounding box, etc.) should be computed and written as grid metadata. |
Static Public Attributes | |
static const int | sFormatVersionIndex |
static const int | sLibraryMajorVersionIndex |
static const int | sLibraryMinorVersionIndex |
static const int | sDataCompressionIndex |
static const int | sWriteGridStatsMetadataIndex |
static const int | sGridBackgroundIndex |
static const int | sGridClassIndex |
static const uint32_t | DEFAULT_COMPRESSION_FLAGS |
Protected Types | |
typedef std::map< Name, GridBase::Ptr > | NamedGridMap |
Protected Member Functions | |
bool | inputHasGridOffsets () const |
Return true if the input stream contains grid offsets that allow for random access or partial reading. | |
void | setInputHasGridOffsets (bool b) |
void | setFormatVersion (std::istream &) |
Tag the given input stream with the input file format version number. | |
void | setLibraryVersion (std::istream &) |
Tag the given input stream with the version number of the library with which the input stream was created. | |
void | setDataCompression (std::istream &) |
Tag the given input stream with flags indicating whether the input stream contains compressed data and how it is compressed. | |
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. | |
void | setWriteGridStatsMetadata (std::ostream &) |
Tag the given output stream with a flag indicating whether to compute and write grid statistics metadata. | |
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. | |
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. | |
void | writeHeader (std::ostream &, bool seekable) const |
Write the magic number, version numbers, UUID, etc. to the given output stream. | |
void | write (std::ostream &, const GridPtrVec &, bool seekable, const MetaMap &=MetaMap()) const |
Write the given grids to an output stream. | |
void | write (std::ostream &, const GridCPtrVec &, bool seekable, const MetaMap &=MetaMap()) const |
Write the given grids to an output stream. |
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. | |
static int | readGridCount (std::istream &) |
Read in and return the number of grids on the input stream. | |
static void | readGrid (GridBase::Ptr, const GridDescriptor &, std::istream &) |
Populate the given grid from the input stream. |
Friends | |
class | ::TestFile |
class | ::TestStream |
Grid archive associated with a file on disk.
|
protectedinherited |
typedef std::multimap<Name, GridDescriptor> NameMap |
typedef NameMap::const_iterator NameMapCIter |
|
explicit |
~File | ( | ) |
NameIterator beginName | ( | ) | const |
void close | ( | ) |
Close the file once we are done reading from it.
|
inlineinherited |
Return a bit mask specifying compression options for the data stream.
|
protectedinherited |
If the grid represented by the given grid descriptor is an instance, connect it with its instance parent.
NameIterator endName | ( | ) | const |
|
inline |
|
inlineinherited |
Return the file format version number of the input stream.
GridPtrVecPtr getGrids | ( | ) | const |
Read the entire contents of the file and return a list of grid pointers.
MetaMap::Ptr getMetadata | ( | ) | const |
Return (in a newly created MetaMap) the file-level metadata.
|
inherited |
Return the UUID that was most recently written (or read, if no UUID has been written yet).
bool hasGrid | ( | const Name & | ) | const |
Return true
if a grid of the given name exists in this file.
|
inlineprotectedinherited |
Return true
if the input stream contains grid offsets that allow for random access or partial reading.
|
inherited |
Return true
if the data stream is Zip-compressed.
|
inlineinherited |
Return true
if grid statistics (active voxel count and bounding box, etc.) are computed and written as grid metadata.
|
inherited |
Return true
if the given UUID matches this archive's UUID.
|
inlineinherited |
Return true
if trees shared by multiple grids are written out only once, false
if they are written out once per grid.
|
inline |
Return true
if the file has been opened for reading, false otherwise.
|
inlineinherited |
Return the (major, minor) version number of the library that was used to write the input stream.
bool open | ( | ) |
Open the file, read the file header and the file-level metadata, and populate the grid descriptors, but do not load any grids into memory.
IoError | if the file is not a valid VDB file. |
true
if the file's UUID has changed since it was last read. GridPtrVecPtr readAllGridMetadata | ( | ) |
Read just the grid metadata and transforms from the file and return a list of pointers to grids that are empty except for their metadata and transforms.
IoError | if this file is not open for reading. |
GridBase::Ptr readGrid | ( | const Name & | ) |
Read an entire grid, including all of its data blocks.
|
staticprotectedinherited |
Populate the given grid from the input stream.
|
staticprotectedinherited |
Read in the compression flags for a grid and tag the given input stream with those flags.
|
staticprotectedinherited |
Read in and return the number of grids on the input stream.
GridBase::Ptr readGridMetadata | ( | const Name & | ) |
GridBase::ConstPtr readGridPartial | ( | const Name & | ) |
Read a grid's metadata, topology, transform, etc., but not any of its leaf node data blocks.
const
pointer, so that the grid can't be changed before its data blocks have been loaded. A non-const
pointer is only returned when readGrid() is called.
|
protectedinherited |
Read the magic number, version numbers, UUID, etc. from the given input stream.
true
if the input UUID differs from the previously-read UUID.
|
inherited |
Specify whether the data stream should be Zip-compressed.
Enabling Zip compression makes I/O slower, but saves space. Disable it only if raw I/O speed is a concern.
|
inlineinherited |
Specify whether and how the data stream should be compressed. [Mainly for internal use].
c | bitwise OR (e.g., COMPRESS_ZIP | COMPRESS_ACTIVE_MASK) of compression option flags (see Compression.h for the available flags) |
|
protectedinherited |
Tag the given input stream with flags indicating whether the input stream contains compressed data and how it is compressed.
|
protectedinherited |
Tag the given input stream with the input file format version number.
The tag can be retrieved with getFormatVersion().
|
protectedinherited |
Tag an output stream with flags specifying only those compression options that are applicable to the given grid.
|
inlineinherited |
Specify whether grid statistics (active voxel count and bounding box, etc.) should be computed and written as grid metadata.
|
inlineprotectedinherited |
|
inlineinherited |
Specify whether trees shared by multiple grids should be written out only once (true
) or once per grid (false
).
|
protectedinherited |
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().
|
protectedinherited |
Tag the given output stream with a flag indicating whether to compute and write grid statistics metadata.
|
inherited |
Return a string of the form "<major>.<minor>/<format>", giving the library and file format version numbers associated with the input stream.
|
inline |
Write the grids in the given container to the file whose name was given in the constructor.
|
inline |
|
protectedinherited |
Write the given grids to an output stream.
|
protectedinherited |
Write the given grids to an output stream.
|
protectedinherited |
Write the given grid descriptor and grid to an output stream and update the GridDescriptor offsets.
seekable | if true, the output stream supports seek operations |
|
protectedinherited |
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.
seekable | if true, the output stream supports seek operations |
|
protectedinherited |
Write the magic number, version numbers, UUID, etc. to the given output stream.
seekable | if true, the output stream supports seek operations |
|
friend |
|
friend |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |