OpenVDB  9.0.1
Public Types | Public Member Functions | Static Public Member Functions | List of all members
CustomData Class Reference

The custom data class is a simple container for named openvdb metadata. Its primary use case is passing arbitrary "external" data to an AX executable object when calling Compiler::compile. For example, it is the mechanism by which we pass data held inside of a parent DCC to executable AX code. More...

#include <openvdb_ax/compiler/CustomData.h>

Public Types

using Ptr = std::shared_ptr< CustomData >
 
using ConstPtr = std::shared_ptr< const CustomData >
 
using UniquePtr = std::unique_ptr< CustomData >
 

Public Member Functions

 CustomData ()
 
void reset ()
 Reset the custom data. This will clear and delete all previously added data. This will invalidated any executable which links to this custom data. More...
 
bool hasData (const Name &name)
 Checks whether or not data of given name has been inserted. More...
 
template<typename TypedDataCacheT >
bool hasData (const Name &name)
 Checks whether or not data of given name and type has been inserted. More...
 
const Metadata::ConstPtr getData (const Name &name) const
 Retrieves a const pointer to data of given name. If it does not exist, returns nullptr. More...
 
template<typename TypedDataCacheT >
const TypedDataCacheT * getData (const Name &name) const
 Retrieves a const pointer to data of given name and type. If it does not exist, returns nullptr. More...
 
template<typename TypedDataCacheT >
TypedDataCacheT * getOrInsertData (const Name &name)
 Retrieves or inserts typed metadata. If the data exists, it is dynamic-casted to the expected type, which may result in a nullptr. If the data does not exist it is guaranteed to be inserted and returned. The value of the inserted data can then be modified. More...
 
template<typename TypedDataCacheT >
void insertData (const Name &name, const typename TypedDataCacheT::Ptr data)
 Inserts data of specified type with given name. More...
 
void insertData (const Name &name, const Metadata::Ptr data)
 Inserts data with given name. More...
 

Static Public Member Functions

static UniquePtr create ()
 

Detailed Description

The custom data class is a simple container for named openvdb metadata. Its primary use case is passing arbitrary "external" data to an AX executable object when calling Compiler::compile. For example, it is the mechanism by which we pass data held inside of a parent DCC to executable AX code.

Member Typedef Documentation

using ConstPtr = std::shared_ptr<const CustomData>
using Ptr = std::shared_ptr<CustomData>
using UniquePtr = std::unique_ptr<CustomData>

Constructor & Destructor Documentation

CustomData ( )
inline

Member Function Documentation

static UniquePtr create ( )
inlinestatic
const Metadata::ConstPtr getData ( const Name name) const
inline

Retrieves a const pointer to data of given name. If it does not exist, returns nullptr.

const TypedDataCacheT* getData ( const Name name) const
inline

Retrieves a const pointer to data of given name and type. If it does not exist, returns nullptr.

Parameters
nameName of the data entry
Returns
The metadata. If the type does not match, nullptr is returned.
TypedDataCacheT* getOrInsertData ( const Name name)
inline

Retrieves or inserts typed metadata. If the data exists, it is dynamic-casted to the expected type, which may result in a nullptr. If the data does not exist it is guaranteed to be inserted and returned. The value of the inserted data can then be modified.

bool hasData ( const Name name)
inline

Checks whether or not data of given name has been inserted.

bool hasData ( const Name name)
inline

Checks whether or not data of given name and type has been inserted.

void insertData ( const Name name,
const typename TypedDataCacheT::Ptr  data 
)
inline

Inserts data of specified type with given name.

Parameters
nameName of the data
dataShared pointer to the data
Note
If an entry of the given name already exists, will copy the data into the existing entry rather than overwriting the pointer
void insertData ( const Name name,
const Metadata::Ptr  data 
)
inline

Inserts data with given name.

Parameters
nameName of the data
dataThe metadata
Note
If an entry of the given name already exists, will copy the data into the existing entry rather than overwriting the pointer
void reset ( )
inline

Reset the custom data. This will clear and delete all previously added data. This will invalidated any executable which links to this custom data.