OpenVDB: CustomData Class Reference

OpenVDB 8.1.0

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 <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

## ◆ ConstPtr

using ConstPtr = std::shared_ptr<const CustomData>

## ◆ Ptr

using Ptr = std::shared_ptr<CustomData>

## ◆ UniquePtr

using UniquePtr = std::unique_ptr<CustomData>

## Constructor & Destructor Documentation

## ◆ CustomData()

CustomData | ( |  | ) |
| inline

## Member Function Documentation

## ◆ create()

static UniquePtr create | ( |  | ) |
| inlinestatic

## ◆ getData() [1/2]

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.

## ◆ getData() [2/2]

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

  name | Name of the data entry

Returns
  The metadata. If the type does not match, nullptr is returned.

## ◆ getOrInsertData()

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.

## ◆ hasData() [1/2]

bool hasData | ( | const Name & | name | ) |
| inline

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

## ◆ hasData() [2/2]

bool hasData | ( | const Name & | name | ) |
| inline

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

## ◆ insertData() [1/2]

void insertData | ( | const Name & | name,
|  | const Metadata::Ptr | data
| ) |  |
| inline

Inserts data with given name.

Parameters

  name | Name of the data
  data | The metadata

Note
  If an entry of the given name already exists, will copy the data into the existing entry rather than overwriting the pointer

## ◆ insertData() [2/2]

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

Inserts data of specified type with given name.

Parameters

  name | Name of the data
  data | Shared 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

## ◆ reset()

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.

The documentation for this class was generated from the following file:

- CustomData.h