35 #ifndef IECOREGL_NAMESTATECOMPONENT_H
36 #define IECOREGL_NAMESTATECOMPONENT_H
40 #include "tbb/spin_rw_mutex.h"
42 #include "boost/multi_index_container.hpp"
43 #include "boost/multi_index/member.hpp"
44 #include "boost/multi_index/ordered_index.hpp"
46 #include "IECoreGL/Export.h"
47 #include "IECoreGL/StateComponent.h"
48 #include "IECore/InternedString.h"
66 const std::string &name()
const;
69 GLuint glName()
const;
72 void bind()
const override;
77 static const std::string &nameFromGLName( GLuint glName );
82 static GLuint glNameFromName(
const std::string &name,
bool createIfMissing=
false );
86 typedef std::pair<IECore::InternedString, unsigned int> NamePair;
87 typedef boost::multi_index::multi_index_container<
89 boost::multi_index::indexed_by<
90 boost::multi_index::ordered_unique<
91 boost::multi_index::member<NamePair, IECore::InternedString, &NamePair::first>
93 boost::multi_index::ordered_unique<
94 boost::multi_index::member<NamePair, unsigned int, &NamePair::second>
98 typedef NameMap::nth_index_const_iterator<0>::type ConstNameIterator;
100 static ConstNameIterator iteratorFromName(
const std::string &name,
bool createIfMissing );
102 ConstNameIterator m_it;
104 static NameMap g_nameMap;
105 typedef tbb::spin_rw_mutex Mutex;
106 static Mutex g_nameMapMutex;
108 static Description<NameStateComponent> g_description;
116 #endif // IECOREGL_NAMESTATECOMPONENT_H
Definition: NameStateComponent.h:56
Definition: StateComponent.h:51
The namespace within which all CoreGL functionality is defined.
Definition: AlphaTexture.h:41