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);
75 for (
auto it = myTable.begin(); !it.atEnd(); ++it)
76 mem += it->second->getDeviceMemoryUsage();
77 for (
auto it = myPrivateTable.begin(); !it.atEnd(); ++it)
78 mem += it->second->getDeviceMemoryUsage();
107 myPrivateTable.clear();
114 return myTable.size() + myPrivateTable.size() + numGroups();
120 return myTable.size();
122 return myPrivateTable.size();
130 return myTable.empty() && myPrivateTable.empty() && (numGroups()==0);
134 {
return entries(scope) == 0; }
156 proxy()->getAttribute();
164 return myIterator->second;
171 return proxy()->getAttribute();
183 return myIterator.getCurrent() == cmp.
myIterator.getCurrent() || (myIterator.atEnd() && cmp.
myIterator.atEnd());
190 return myIterator.getCurrent() != cmp.
myIterator.getCurrent() && !(myIterator.atEnd() && cmp.
myIterator.atEnd());
195 return myIterator.atEnd();
209 myIterator = myDict->myPrivateTable.begin();
211 if (!myIterator.atEnd())
219 myGroupIterator = grouptable->
begin();
232 myScope = src.myScope;
233 myCurrentScope = src.myCurrentScope;
243 , myCurrentScope(scope)
247 myIterator = end ? dict->myTable.
end() : dict->myTable.
begin();
253 myIterator = dict->myTable.
begin();
254 if (!myIterator.atEnd())
259 myIterator = dict->myPrivateTable.
begin();
260 if (!myIterator.atEnd())
268 myGroupIterator = grouptable->
begin();
278 myGroupIterator = grouptable->
end();
283 myIterator = dict->myPrivateTable.
end();
291 myGroupIterator = end ? grouptable->
end() : grouptable->
begin();
293 myIterator = dict->myPrivateTable.
end();
298 myIterator = end ? dict->myPrivateTable.
end() : dict->myPrivateTable.
begin();
321 : myBegin(dict.
begin(scope))
322 , myEnd(dict.end(scope))
339 {
return Range(*
this, scope); }
343 const char *aname = (*a)->getName();
344 const char *bname = (*b)->getName();
345 if (!strcmp(aname,
"P"))
347 if (!strcmp(bname,
"P"))
361 {
return iterator(
this, scope,
false); }
364 {
return iterator(
this, scope,
true); }
372 iterator it(
this, scope,
false);
382 template<
typename FUNCTOR>
386 if (!myTable.empty())
387 myTable.forEachValue(functor);
388 if (!myPrivateTable.empty())
389 myPrivateTable.forEachValue(functor);
391 if (grouptable && !grouptable->
empty())
394 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
399 template<
typename FUNCTOR>
404 myTable.forEachValue(functor);
406 myPrivateTable.forEachValue(functor);
410 if (grouptable && !grouptable->
empty())
413 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
419 template<
typename FUNCTOR>
423 if (!myTable.empty())
429 if (!myPrivateTable.empty())
436 if (grouptable && !grouptable->
empty())
439 functor(UTverify_cast<GA_ElementGroup*>(group));
444 template<
typename FUNCTOR>
463 if (grouptable && !grouptable->
empty())
466 functor(UTverify_cast<GA_ElementGroup*>(group));
472 template<
typename FUNCTOR>
477 myTable.forEachKey(functor);
479 myPrivateTable.forEachKey(functor);
483 if (grouptable && !grouptable->
empty())
497 myTable.setNumBuckets(nbuckets);
499 myPrivateTable.setNumBuckets(nbuckets);
512 if (myTable.size()+n > myTable.bucket_count())
513 myTable.rehash(myTable.size()+
n);
517 if (myPrivateTable.size()+n > myPrivateTable.bucket_count())
518 myPrivateTable.rehash(myPrivateTable.size()+
n);
529 myTable.insert(std::make_pair(name, proxy));
531 myPrivateTable.insert(std::make_pair(name, proxy));
542 myPrivateTable.erase(name);
550 void bumpVersionParms() { myVersionParms++; }
554 auto table = getGroupTable();
566 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.
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
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()
int64 getDeviceMemoryUsage() const
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)
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.