OpenVDB 12.1.0

Loading...
Searching...
No Matches
AttributeBindings Class Reference

This class wraps an interface for a map of attribute bindings. These map attributes in AX code to context data. These mappings are one-to-one i.e. each AX name can only map to one data name, however each name can appear as either an AX name or data name or both, i.e. the following sets of bindings are valid: axname: a -> dataname: a axname: b -> dataname: c or axname: a -> dataname: b axname: b -> dataname: a. More...

`#include <openvdb_ax/compiler/AttributeBindings.h>`

## Public Member Functions
| AttributeBindings ()=default
| AttributeBindings (const std::vector< std::pair< std::string, std::string > > &bindings)
| Construct a set of attribute bindings from a vector of {ax name, data name} pairs.
| AttributeBindings (const std::initializer_list< std::pair< std::string, std::string > > &bindings)
| Construct a set of attribute bindings from a vector of {ax name, data name} pairs using an initializer list i.e. {{"axname0", "dataname0"}, {"axname1", "dataname0"}}.
bool | operator== (const AttributeBindings &other) const
void | set (const std::string &axname, const std::string &dataname)
| Set up a binding. If a data binding exists for this AX name, it will be replaced. If another binding exists for the supplied dataname that will be removed.
void | set (const std::vector< std::pair< std::string, std::string > > &bindings)
| Set up multiple bindings from a vector of {ax name, data name} pairs. If a data binding exists for any AX name, it will be replaced. If another binding exists for the supplied dataname that will be removed.
const std::string * | dataNameBoundTo (const std::string &axname) const
| Returns a pointer to the data attribute name string that the input AX attribute name is bound to, or nullptr if unbound.
const std::string * | axNameBoundTo (const std::string &name) const
| Returns a pointer to the AX attribute name string that a data attribute name is bound to, or nullptr if unbound.
bool | isBoundDataName (const std::string &name) const
| Returns whether the data attribute has been bound to an AX attribute.
bool | isBoundAXName (const std::string &name) const
| Returns whether the AX attribute has been bound to a data attribute.
const std::map< std::string, std::string > & | axToDataMap () const
| Returns the map of AX attribute names to data attribute names.
const std::map< std::string, std::string > & | dataToAXMap () const
| Returns the map of data attribute names to AX attribute names.

## Detailed Description

This class wraps an interface for a map of attribute bindings. These map attributes in AX code to context data. These mappings are one-to-one i.e. each AX name can only map to one data name, however each name can appear as either an AX name or data name or both, i.e. the following sets of bindings are valid: axname: a -> dataname: a axname: b -> dataname: c or axname: a -> dataname: b axname: b -> dataname: a.

## Constructor & Destructor Documentation

## ◆ AttributeBindings() [1/3]

AttributeBindings | ( |  | ) |
| default

## ◆ AttributeBindings() [2/3]

AttributeBindings | ( | const std::vector< std::pair< std::string, std::string > > & | bindings | ) |
| inline

Construct a set of attribute bindings from a vector of {ax name, data name} pairs.

Parameters

  bindings | A vector of ax name data name pairs where the first element is the name in the AX code, and the second is the name in the context data

## ◆ AttributeBindings() [3/3]

AttributeBindings | ( | const std::initializer_list< std::pair< std::string, std::string > > & | bindings | ) |
| inline

Construct a set of attribute bindings from a vector of {ax name, data name} pairs using an initializer list i.e. {{"axname0", "dataname0"}, {"axname1", "dataname0"}}.

Parameters

  bindings | A initializer list of ax name data name pairs where the first element is the name in the AX code, and the second is the name in the context data

## Member Function Documentation

## ◆ axNameBoundTo()

const std::string * axNameBoundTo | ( | const std::string & | name | ) | const
| inline

Returns a pointer to the AX attribute name string that a data attribute name is bound to, or nullptr if unbound.

Parameters

  name | The name of the attribute in the context data

## ◆ axToDataMap()

const std::map< std::string, std::string > & axToDataMap | ( |  | ) | const
| inline

Returns the map of AX attribute names to data attribute names.

## ◆ dataNameBoundTo()

const std::string * dataNameBoundTo | ( | const std::string & | axname | ) | const
| inline

Returns a pointer to the data attribute name string that the input AX attribute name is bound to, or nullptr if unbound.

Parameters

  axname | The name of the attribute in AX

## ◆ dataToAXMap()

const std::map< std::string, std::string > & dataToAXMap | ( |  | ) | const
| inline

Returns the map of data attribute names to AX attribute names.

## ◆ isBoundAXName()

bool isBoundAXName | ( | const std::string & | name | ) | const
| inline

Returns whether the AX attribute has been bound to a data attribute.

Parameters

  name | The name of the attribute in AX

## ◆ isBoundDataName()

bool isBoundDataName | ( | const std::string & | name | ) | const
| inline

Returns whether the data attribute has been bound to an AX attribute.

Parameters

  name | The name of the attribute in the context data

## ◆ operator==()

bool operator== | ( | const AttributeBindings & | other | ) | const
| inline

## ◆ set() [1/2]

void set | ( | const std::string & | axname,
|  | const std::string & | dataname )
| inline

Set up a binding. If a data binding exists for this AX name, it will be replaced. If another binding exists for the supplied dataname that will be removed.

Parameters

  axname | The name of the attribute in AX
  dataname | The name of the attribute in the context data

## ◆ set() [2/2]

void set | ( | const std::vector< std::pair< std::string, std::string > > & | bindings | ) |
| inline

Set up multiple bindings from a vector of {ax name, data name} pairs. If a data binding exists for any AX name, it will be replaced. If another binding exists for the supplied dataname that will be removed.

Parameters

  bindings | Vector of AX name data name pairs