13 #ifndef __GA_AttributeDict__
14 #define __GA_AttributeDict__
63 int64 mem = inclusive ?
sizeof(*this) : 0;
64 mem += myTable.getMemoryUsage(
false);
65 for (
auto it = myTable.begin(); !it.atEnd(); ++it)
66 mem += it->second->getMemoryUsage(
true);
67 mem += myPrivateTable.getMemoryUsage(
false);
68 for (
auto it = myPrivateTable.begin(); !it.atEnd(); ++it)
69 mem += it->second->getMemoryUsage(
true);
98 myPrivateTable.clear();
105 return myTable.size() + myPrivateTable.size() + numGroups();
111 return myTable.size();
113 return myPrivateTable.size();
121 return myTable.empty() && myPrivateTable.empty() && (numGroups()==0);
125 {
return entries(scope) == 0; }
147 proxy()->getAttribute();
155 return myIterator->second;
162 return proxy()->getAttribute();
174 return myIterator.getCurrent() == cmp.
myIterator.getCurrent() || (myIterator.atEnd() && cmp.
myIterator.atEnd());
181 return myIterator.getCurrent() != cmp.
myIterator.getCurrent() && !(myIterator.atEnd() && cmp.
myIterator.atEnd());
186 return myIterator.atEnd();
200 myIterator = myDict->myPrivateTable.begin();
202 if (!myIterator.atEnd())
210 myGroupIterator = grouptable->
begin();
223 myScope = src.myScope;
224 myCurrentScope = src.myCurrentScope;
234 , myCurrentScope(scope)
238 myIterator = end ? dict->myTable.
end() : dict->myTable.
begin();
244 myIterator = dict->myTable.
begin();
245 if (!myIterator.atEnd())
250 myIterator = dict->myPrivateTable.
begin();
251 if (!myIterator.atEnd())
259 myGroupIterator = grouptable->
begin();
269 myGroupIterator = grouptable->
end();
274 myIterator = dict->myPrivateTable.
end();
282 myGroupIterator = end ? grouptable->
end() : grouptable->
begin();
284 myIterator = dict->myPrivateTable.
end();
289 myIterator = end ? dict->myPrivateTable.
end() : dict->myPrivateTable.
begin();
312 : myBegin(dict.
begin(scope))
313 , myEnd(dict.end(scope))
330 {
return Range(*
this, scope); }
334 const char *aname = (*a)->getName();
335 const char *bname = (*b)->getName();
336 if (!strcmp(aname,
"P"))
338 if (!strcmp(bname,
"P"))
352 {
return iterator(
this, scope,
false); }
355 {
return iterator(
this, scope,
true); }
363 iterator it(
this, scope,
false);
373 template<
typename FUNCTOR>
377 if (!myTable.empty())
378 myTable.forEachValue(functor);
379 if (!myPrivateTable.empty())
380 myPrivateTable.forEachValue(functor);
382 if (grouptable && !grouptable->
empty())
385 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
390 template<
typename FUNCTOR>
395 myTable.forEachValue(functor);
397 myPrivateTable.forEachValue(functor);
401 if (grouptable && !grouptable->
empty())
404 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
410 template<
typename FUNCTOR>
414 if (!myTable.empty())
420 if (!myPrivateTable.empty())
427 if (grouptable && !grouptable->
empty())
430 functor(UTverify_cast<GA_ElementGroup*>(group));
435 template<
typename FUNCTOR>
454 if (grouptable && !grouptable->
empty())
457 functor(UTverify_cast<GA_ElementGroup*>(group));
463 template<
typename FUNCTOR>
468 myTable.forEachKey(functor);
470 myPrivateTable.forEachKey(functor);
474 if (grouptable && !grouptable->
empty())
488 myTable.setNumBuckets(nbuckets);
490 myPrivateTable.setNumBuckets(nbuckets);
503 if (myTable.size()+n > myTable.bucket_count())
504 myTable.rehash(myTable.size()+
n);
508 if (myPrivateTable.size()+n > myPrivateTable.bucket_count())
509 myPrivateTable.rehash(myPrivateTable.size()+
n);
520 myTable.insert(std::make_pair(name, proxy));
522 myPrivateTable.insert(std::make_pair(name, proxy));
533 myPrivateTable.erase(name);
541 void bumpVersionParms() { myVersionParms++; }
545 auto table = getGroupTable();
557 exint myVersionParms;
SYS_FORCE_INLINE GA_AttributeProxy * proxy() const
SYS_FORCE_INLINE void forEachAttribute(FUNCTOR &&functor) const
Definition of a geometry attribute.
SYS_FORCE_INLINE void forEachAttribute(GA_AttributeScope scope, FUNCTOR &&functor) const
SYS_FORCE_INLINE void forEachName(GA_AttributeScope scope, FUNCTOR &&functor) const
SYS_FORCE_INLINE const iterator & operator=(const iterator &src)
SYS_FORCE_INLINE const char * name() const
SYS_FORCE_INLINE GA_Attribute * getAttribute()
UT_ArrayStringMap< GA_Group * >::const_iterator myGroupIterator
SYS_FORCE_INLINE void forEachValue(FUNCTOR &&functor) const
int64 getMemoryUsage(bool inclusive) const
Report memory usage.
SYS_FORCE_INLINE ordered_iterator obegin(GA_AttributeScope scope=GA_SCOPE_INVALID) const
SYS_FORCE_INLINE bool atEnd() const
SYS_FORCE_INLINE iterator begin() const
SYS_FORCE_INLINE exint entries(GA_AttributeScope scope) const
UT_ArrayStringMap< GA_Group * > MapType
GA_AttributeDict::iterator iterator
SYS_FORCE_INLINE void forEachKey(FUNCTOR &&functor) const
GLboolean GLboolean GLboolean GLboolean a
bool empty() const
Returns true iff there are no items in the set.
SYS_FORCE_INLINE GA_Attribute * attrib() const
exint getVersionParms() const
iterator end()
Returns a non-const end iterator for the set.
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
SYS_FORCE_INLINE bool operator!=(const iterator &cmp) const
Standard user attribute level.
MapType::iterator map_iterator
UT_ArrayStringMap< GA_AttributeProxy * > MapType
SYS_FORCE_INLINE iterator begin(GA_AttributeScope scope=GA_SCOPE_INVALID) const
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
SYS_FORCE_INLINE const UT_StringHolder & getName() const
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
Parent::const_iterator const_iterator
SYS_FORCE_INLINE GA_AttributeSet & getSet()
This class holds a reference to an attribute. Such an indirection level allows an easy way to invalid...
SYS_FORCE_INLINE Range(const GA_AttributeDict &dict, GA_AttributeScope scope)
iterator begin()
Returns a non-const iterator for the beginning of the set.
GA_AttributeDict::iterator const_iterator
Parent::iterator iterator
Data has no numeric representation.
SYS_FORCE_INLINE const char * c_str() const
SYS_FORCE_INLINE bool empty(GA_AttributeScope scope) const
GLuint const GLchar * name
SYS_FORCE_INLINE iterator & operator++()
UT_OrderedIterator< GA_Attribute *, iterator > ordered_iterator
Iterator which traverses attributes in given order.
GLboolean GLboolean GLboolean b
SYS_FORCE_INLINE GA_Attribute * operator*() const
SYS_FORCE_INLINE bool operator==(const iterator &cmp) const
GLenum GLenum GLsizei void * table
SYS_FORCE_INLINE void clear()
SYS_FORCE_INLINE void forEachProxy(GA_AttributeScope scope, FUNCTOR &&functor) const
static int compareNumberedString(const char *s1, const char *s2, bool case_sensitive=true, bool allow_negatives=false)
MapType::const_iterator const_map_iterator
SYS_FORCE_INLINE ~iterator()
SYS_FORCE_INLINE iterator end(GA_AttributeScope scope=GA_SCOPE_INVALID) const
SYS_FORCE_INLINE bool empty() const
SYS_FORCE_INLINE iterator end() const
SYS_FORCE_INLINE Range range(GA_AttributeScope scope) const
SYS_FORCE_INLINE ordered_iterator oend(GA_AttributeScope scope=GA_SCOPE_INVALID) const
SYS_FORCE_INLINE const GA_AttributeSet & getSet() const
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
SYS_FORCE_INLINE void forEachProxy(FUNCTOR &&functor) const
SYS_FORCE_INLINE iterator()
static int compareAlpha(GA_Attribute *const *a, GA_Attribute *const *b)
GA_AttributeDict::const_map_iterator myIterator
SYS_FORCE_INLINE iterator(const iterator &src)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
SYS_FORCE_INLINE exint entries() const
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.