OpenVDB
9.0.1
|
Grid archive associated with a file on disk. More...
#include <openvdb/io/File.h>
Inherits Archive.
Classes | |
class | NameIterator |
Public Types | |
using | NameMap = std::multimap< Name, GridDescriptor > |
using | NameMapCIter = NameMap::const_iterator |
using | Ptr = SharedPtr< Archive > |
using | ConstPtr = SharedPtr< const Archive > |
Public Member Functions | |
File (const std::string &filename) | |
~File () override | |
File (const File &other) | |
Copy constructor. More... | |
File & | operator= (const File &other) |
Assignment. More... | |
SharedPtr< Archive > | copy () const override |
Return a copy of this archive. More... | |
const std::string & | filename () const |
Return the name of the file with which this archive is associated. More... | |
bool | open (bool delayLoad=true, const MappedFile::Notifier &=MappedFile::Notifier()) |
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. More... | |
bool | isOpen () const |
Return true if the file has been opened for reading. More... | |
void | close () |
Close the file once we are done reading from it. More... | |
Index64 | getSize () const |
Return this file's current size on disk in bytes. More... | |
Index64 | copyMaxBytes () const |
Return the size in bytes above which this file will not be automatically copied during delayed loading. More... | |
void | setCopyMaxBytes (Index64 bytes) |
If this file is opened with delayed loading enabled, make a private copy of the file if its size in bytes is less than the specified value. More... | |
bool | hasGrid (const Name &) const |
Return true if a grid of the given name exists in this file. More... | |
MetaMap::Ptr | getMetadata () const |
Return (in a newly created MetaMap) the file-level metadata. More... | |
GridPtrVecPtr | getGrids () const |
Read the entire contents of the file and return a list of grid pointers. More... | |
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. More... | |
GridBase::Ptr | readGridMetadata (const Name &) |
Read a grid's metadata and transform only. More... | |
GridBase::Ptr | readGrid (const Name &) |
Read an entire grid, including all of its data blocks. More... | |
GridBase::Ptr | readGrid (const Name &, const BBoxd &) |
Read a grid, including its data blocks, but only where it intersects the given world-space bounding box. More... | |
void | write (const GridCPtrVec &, const MetaMap &=MetaMap()) const override |
Write the grids in the given container to the file whose name was given in the constructor. More... | |
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. More... | |
NameIterator | beginName () const |
NameIterator | endName () const |
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... | |
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 |
class | ::TestStream |
Grid archive associated with a file on disk.
|
protectedinherited |
using NameMap = std::multimap<Name, GridDescriptor> |
using NameMapCIter = NameMap::const_iterator |
|
explicit |
|
override |
Copy constructor.
The copy will be closed and will not reference the same file descriptor as the original.
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.
Return a copy of this archive.
The copy will be closed and will not reference the same file descriptor as the original.
Reimplemented from Archive.
Index64 copyMaxBytes | ( | ) | const |
Return the size in bytes above which this file will not be automatically copied during delayed loading.
NameIterator endName | ( | ) | const |
const std::string& filename | ( | ) | const |
Return the name of the file with which this archive is associated.
The file does not necessarily exist on disk yet.
|
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.
Index64 getSize | ( | ) | const |
Return this file's current size on disk in bytes.
IoError | if the file size cannot be determined. |
|
inherited |
Return the UUID that was most recently written (or read, if no UUID has been written yet).
|
staticinherited |
Return true
if the OpenVDB library includes support for the Blosc compressor.
bool hasGrid | ( | const Name & | ) | const |
Return true
if a grid of the given name exists in this file.
|
staticinherited |
Return true
if the OpenVDB library includes support for the ZLib compressor.
|
inlineprotectedinherited |
Return true
if the input stream contains grid offsets that allow for random access or partial reading.
|
staticinherited |
Return true
if delayed loading is enabled.
If enabled, delayed loading can be disabled for individual files, but not vice-versa.
OPENVDB_DISABLE_DELAYED_LOAD
to disable delayed loading unconditionally.
|
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.
bool isOpen | ( | ) | const |
Return true
if the file has been opened for reading.
|
inlineinherited |
Return the (major, minor) version number of the library that was used to write the input stream.
bool open | ( | bool | delayLoad = true , |
const MappedFile::Notifier & | = MappedFile::Notifier() |
||
) |
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.
If delayLoad is true, map the file into memory and enable delayed loading of grids, and if a notifier is provided, call it when the file gets unmapped.
OPENVDB_DISABLE_DELAYED_LOAD
to disable delayed loading unconditionally. 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.
GridBase::Ptr readGrid | ( | const Name & | , |
const BBoxd & | |||
) |
Read a grid, including its data blocks, but only where it intersects the given world-space bounding box.
|
staticprotectedinherited |
Populate the given grid from the input stream.
|
staticprotectedinherited |
Populate the given grid from the input stream, but only where it intersects the given world-space bounding box.
|
staticprotectedinherited |
Populate the given grid from the input stream, but only where it intersects the given index-space bounding box.
|
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 & | ) |
|
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.
|
inlineinherited |
Specify whether and how the data stream should be compressed.
c | bitwise OR (e.g., COMPRESS_ZIP | COMPRESS_ACTIVE_MASK) of compression option flags (see Compression.h for the available flags) |
void setCopyMaxBytes | ( | Index64 | bytes | ) |
If this file is opened with delayed loading enabled, make a private copy of the file if its size in bytes is less than the specified value.
Making a private copy ensures that the file can't change on disk before it has been fully read.
OPENVDB_DELAYED_LOAD_COPY_MAX_BYTES
to the desired number of bytes.
|
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().
|
inherited |
Return a string of the form "<major>.<minor>/<format>", giving the library and file format version numbers associated with the input stream.
|
inlineoverridevirtual |
Write the grids in the given container to the file whose name was given in the constructor.
Reimplemented from Archive.
Write the grids in the given container to the file whose name was given in the constructor.
|
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 |