OpenVDB  9.0.1
Public Member Functions | List of all members
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. More...
 
 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"}}. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
bool isBoundDataName (const std::string &name) const
 Returns whether the data attribute has been bound to an AX attribute. More...
 
bool isBoundAXName (const std::string &name) const
 Returns whether the AX attribute has been bound to a data attribute. More...
 
const std::map< std::string, std::string > & axToDataMap () const
 Returns the map of AX attribute names to data attribute names. More...
 
const std::map< std::string, std::string > & dataToAXMap () const
 Returns the map of data attribute names to AX attribute names. More...
 

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 ( )
default
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
bindingsA 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 ( 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
bindingsA 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

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
nameThe name of the attribute in the context data
const std::map<std::string, std::string>& axToDataMap ( ) const
inline

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

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
axnameThe name of the attribute in AX
const std::map<std::string, std::string>& dataToAXMap ( ) const
inline

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

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

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

Parameters
nameThe name of the attribute in AX
bool isBoundDataName ( const std::string &  name) const
inline

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

Parameters
nameThe name of the attribute in the context data
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
axnameThe name of the attribute in AX
datanameThe name of the attribute in the context data
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
bindingsVector of AX name data name pairs