OpenVDB  12.0.0
Public Member Functions | Static Public Member Functions | List of all members
GridDescriptor Class Reference

#include <openvdb/io/GridDescriptor.h>

Public Member Functions

 GridDescriptor ()
 
 GridDescriptor (const Name &name, const Name &gridType, bool saveFloatAsHalf=false)
 
 GridDescriptor (const GridDescriptor &)=default
 
GridDescriptoroperator= (const GridDescriptor &)=default
 
 ~GridDescriptor ()
 
const NamegridType () const
 
const NamegridName () const
 
const NameuniqueName () const
 
const NameinstanceParentName () const
 
void setInstanceParentName (const Name &name)
 
bool isInstance () const
 
bool saveFloatAsHalf () const
 
void setGridPos (int64_t pos)
 
int64_t getGridPos () const
 
void setBlockPos (int64_t pos)
 
int64_t getBlockPos () const
 
void setEndPos (int64_t pos)
 
int64_t getEndPos () const
 
void seekToGrid (std::istream &) const
 
void seekToBlocks (std::istream &) const
 
void seekToEnd (std::istream &) const
 
void seekToGrid (std::ostream &) const
 
void seekToBlocks (std::ostream &) const
 
void seekToEnd (std::ostream &) const
 
void writeHeader (std::ostream &) const
 Write out this descriptor's header information (all data except for stream offsets). More...
 
void writeStreamPos (std::ostream &) const
 Since positions into the stream are known at a later time, they are written out separately. More...
 
GridBase::Ptr read (std::istream &)
 Read a grid descriptor from the given stream. More...
 

Static Public Member Functions

static Name addSuffix (const Name &, int n)
 Append the number n to the given name (separated by an ASCII "record separator" character) and return the resulting name. More...
 
static Name stripSuffix (const Name &)
 Strip from the given name any suffix that is separated by an ASCII "record separator" character and return the resulting name. More...
 
static std::string nameAsString (const Name &)
 Given a name with suffix N, return "name[N]", otherwise just return "name". Use this to produce a human-readable string from a descriptor's unique name. More...
 
static Name stringAsUniqueName (const std::string &)
 Given a string of the form "name[N]", return "name" with the suffix N separated by an ASCII "record separator" character). Otherwise just return the string as is. More...
 

Detailed Description

This structure stores useful information that describes a grid on disk. It can be used to retrieve I/O information about the grid such as offsets into the file where the grid is located, its type, etc.

Constructor & Destructor Documentation

GridDescriptor ( const Name name,
const Name gridType,
bool  saveFloatAsHalf = false 
)
GridDescriptor ( const GridDescriptor )
default

Member Function Documentation

static Name addSuffix ( const Name ,
int  n 
)
static

Append the number n to the given name (separated by an ASCII "record separator" character) and return the resulting name.

int64_t getBlockPos ( ) const
inline
int64_t getEndPos ( ) const
inline
int64_t getGridPos ( ) const
inline
const Name& gridName ( ) const
inline
const Name& gridType ( ) const
inline
const Name& instanceParentName ( ) const
inline
bool isInstance ( ) const
inline
static std::string nameAsString ( const Name )
static

Given a name with suffix N, return "name[N]", otherwise just return "name". Use this to produce a human-readable string from a descriptor's unique name.

GridDescriptor& operator= ( const GridDescriptor )
default
GridBase::Ptr read ( std::istream &  )

Read a grid descriptor from the given stream.

Returns
an empty grid of the type specified by the grid descriptor.
bool saveFloatAsHalf ( ) const
inline
void seekToBlocks ( std::istream &  ) const
void seekToBlocks ( std::ostream &  ) const
void seekToEnd ( std::istream &  ) const
void seekToEnd ( std::ostream &  ) const
void seekToGrid ( std::istream &  ) const
void seekToGrid ( std::ostream &  ) const
void setBlockPos ( int64_t  pos)
inline
void setEndPos ( int64_t  pos)
inline
void setGridPos ( int64_t  pos)
inline
void setInstanceParentName ( const Name name)
inline
static Name stringAsUniqueName ( const std::string &  )
static

Given a string of the form "name[N]", return "name" with the suffix N separated by an ASCII "record separator" character). Otherwise just return the string as is.

static Name stripSuffix ( const Name )
static

Strip from the given name any suffix that is separated by an ASCII "record separator" character and return the resulting name.

const Name& uniqueName ( ) const
inline
void writeHeader ( std::ostream &  ) const

Write out this descriptor's header information (all data except for stream offsets).

void writeStreamPos ( std::ostream &  ) const

Since positions into the stream are known at a later time, they are written out separately.