![]() |
OpenVDB 13.2.0
|
Mutable per-operation state created by Codec::createData() and passed into every read and write call on a given codec.
More...
#include <openvdb/io/Codec.h>
Public Types | |
| using | Ptr = std::unique_ptr<CodecData> |
Public Member Functions | |
| virtual | ~CodecData ()=default |
Public Attributes | |
| SharedPtr< GridBase > | grid |
| The grid being populated on read, or being serialized on write. | |
Mutable per-operation state created by Codec::createData() and passed into every read and write call on a given codec.
The main purpose of this class is to provide a mechanism for passing additional state between the different methods in the codec. ReadOptions is immutable and cannot carry per-operation state; the codec itself is stateless by design (to allow sharing across threads) and therefore also cannot be used for this purpose.
The base class provides the single field that every codec requires: a shared pointer to the GridBase being populated (on read) or inspected (on write). Derived codecs that need additional transient state should subclass CodecData and add those fields.
A CodecData instance is created once per grid per read or write operation by Codec::createData(), which also allocates the concrete GridBase subclass and stores it in grid.
Inside Codec::createData(), the derived type is allocated and returned:
In the read and write methods, downcast the reference back to the concrete type to access the extra fields:
|
virtualdefault |