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)
 
 
   61        return mAXToDataMap == other.mAXToDataMap &&
 
   62            mDataToAXMap == other.mDataToAXMap;
 
 
   69    inline void set(
const std::string& axname, 
const std::string& dataname)
 
   71        auto axToData = mAXToDataMap.find(axname);
 
   72        if (axToData != mAXToDataMap.end()) {
 
   75            auto dataToAX = mDataToAXMap.find(axToData->second);
 
   76            if (dataToAX != mDataToAXMap.end()) {
 
   77                mAXToDataMap.erase(dataToAX->second);
 
   78                mDataToAXMap.erase(dataToAX->first);
 
   81        auto dataToAX = mDataToAXMap.find(dataname);
 
   82        if (dataToAX != mDataToAXMap.end()) {
 
   83            mAXToDataMap.erase(dataToAX->second);
 
   86        mAXToDataMap[axname] = dataname;
 
   87        mDataToAXMap[dataname] = axname;
 
 
   94    inline void set(
const std::vector<std::pair<std::string, std::string>>& bindings) {
 
   95        for (
const auto& binding : bindings) {
 
   96            this->
set(binding.first, binding.second);
 
 
  104        const auto iter = mAXToDataMap.find(axname);
 
  105        if (iter != mAXToDataMap.cend()) {
 
  106            return &iter->second;
 
 
  116        const auto iter = mDataToAXMap.find(name);
 
  117        if (iter != mDataToAXMap.cend()) {
 
  118            return &iter->second;
 
 
  127        return mDataToAXMap.count(name);
 
 
  134        return mAXToDataMap.count(name);
 
 
  138    inline const std::map<std::string, std::string>& 
axToDataMap()
 const {
 
 
  143    inline const std::map<std::string, std::string>& 
dataToAXMap()
 const {
 
 
  149    std::map<std::string, std::string> mAXToDataMap;
 
  150    std::map<std::string, std::string> mDataToAXMap;
 
 
  156    os << 
"ax->data map:\n";
 
  158        os << 
"  [" << m.first << 
" -> " << m.second << 
']' << 
'\n';
 
  160    os << 
"data->ax map:\n";
 
  162        os << 
"  [" << m.first << 
" -> " << m.second  << 
']' << 
'\n';
 
 
OPENVDB_API std::ostream & operator<<(std::ostream &os, half h)
Output h to os, formatted as a float.
This class wraps an interface for a map of attribute bindings. These map attributes in AX code to con...
Definition AttributeBindings.h:37
AttributeBindings()=default
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:114
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 ...
Definition AttributeBindings.h:69
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
bool isBoundDataName(const std::string &name) const
Returns whether the data attribute has been bound to an AX attribute.
Definition AttributeBindings.h:125
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:102
bool operator==(const AttributeBindings &other) const
Definition AttributeBindings.h:59
const std::map< std::string, std::string > & axToDataMap() const
Returns the map of AX attribute names to data attribute names.
Definition AttributeBindings.h:138
bool isBoundAXName(const std::string &name) const
Returns whether the AX attribute has been bound to a data attribute.
Definition AttributeBindings.h:132
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 an...
Definition AttributeBindings.h:94
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
const std::map< std::string, std::string > & dataToAXMap() const
Returns the map of data attribute names to AX attribute names.
Definition AttributeBindings.h:143
Definition Exceptions.h:13
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218