13 #ifndef OPENVDB_AX_COMPILER_ATTRIBUTE_BINDINGS_HAS_BEEN_INCLUDED 14 #define OPENVDB_AX_COMPILER_ATTRIBUTE_BINDINGS_HAS_BEEN_INCLUDED 16 #include <openvdb/version.h> 54 AttributeBindings(
const std::initializer_list<std::pair<std::string, std::string>>& bindings)
65 inline void set(
const std::string& axname,
const std::string& dataname)
67 auto axToData = mAXToDataMap.find(axname);
68 if (axToData != mAXToDataMap.end()) {
71 auto dataToAX = mDataToAXMap.find(axToData->second);
72 if (dataToAX != mDataToAXMap.end()) {
73 mAXToDataMap.erase(dataToAX->second);
74 mDataToAXMap.erase(dataToAX->first);
77 auto dataToAX = mDataToAXMap.find(dataname);
78 if (dataToAX != mDataToAXMap.end()) {
79 mAXToDataMap.erase(dataToAX->second);
82 mAXToDataMap[axname] = dataname;
83 mDataToAXMap[dataname] = axname;
90 inline void set(
const std::vector<std::pair<std::string, std::string>>& bindings) {
91 for (
const auto& binding : bindings) {
92 this->
set(binding.first, binding.second);
100 const auto iter = mAXToDataMap.find(axname);
101 if (iter != mAXToDataMap.cend()) {
102 return &iter->second;
112 const auto iter = mDataToAXMap.find(name);
113 if (iter != mDataToAXMap.cend()) {
114 return &iter->second;
123 return mDataToAXMap.count(name);
130 return mAXToDataMap.count(name);
134 inline const std::map<std::string, std::string>&
axToDataMap()
const {
139 inline const std::map<std::string, std::string>&
dataToAXMap()
const {
145 std::map<std::string, std::string> mAXToDataMap;
146 std::map<std::string, std::string> mDataToAXMap;
154 #endif // OPENVDB_AX_COMPILER_ATTRIBUTE_BINDINGS_HAS_BEEN_INCLUDED const std::map< std::string, std::string > & axToDataMap() const
Returns the map of AX attribute names to data attribute names.
Definition: AttributeBindings.h:134
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...
Definition: AttributeBindings.h:110
const std::map< std::string, std::string > & dataToAXMap() const
Returns the map of data attribute names to AX attribute names.
Definition: AttributeBindings.h:139
bool isBoundAXName(const std::string &name) const
Returns whether the AX attribute has been bound to a data attribute.
Definition: AttributeBindings.h:128
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...
Definition: AttributeBindings.h:98
bool isBoundDataName(const std::string &name) const
Returns whether the data attribute has been bound to an AX attribute.
Definition: AttributeBindings.h:121
Definition: Exceptions.h:13
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 initialize...
Definition: AttributeBindings.h:54
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.
Definition: AttributeBindings.h:45
This class wraps an interface for a map of attribute bindings. These map attributes in AX code to con...
Definition: AttributeBindings.h:36
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202