13 #ifndef __GA_AttributeDict__
14 #define __GA_AttributeDict__
61 int64 mem = inclusive ?
sizeof(*this) : 0;
62 mem += myTable.getMemoryUsage(
false);
63 for (
auto it = myTable.begin(); !it.atEnd(); ++it)
64 mem += it->second->getMemoryUsage(
true);
65 mem += myPrivateTable.getMemoryUsage(
false);
66 for (
auto it = myPrivateTable.begin(); !it.atEnd(); ++it)
67 mem += it->second->getMemoryUsage(
true);
96 myPrivateTable.clear();
103 return myTable.size() + myPrivateTable.size() + numGroups();
108 return myTable.size();
110 return myPrivateTable.size();
117 return myTable.empty() && myPrivateTable.empty() && (numGroups()==0);
120 {
return entries(scope) == 0; }
138 proxy()->getAttribute();
145 return myIterator->second;
151 return proxy()->getAttribute();
161 return myIterator.getCurrent() == cmp.
myIterator.getCurrent() || (myIterator.atEnd() && cmp.
myIterator.atEnd());
167 return myIterator.getCurrent() != cmp.
myIterator.getCurrent() && !(myIterator.atEnd() && cmp.
myIterator.atEnd());
171 return myIterator.atEnd();
183 myIterator = myDict->myPrivateTable.begin();
185 if (!myIterator.atEnd())
193 myGroupIterator = grouptable->
begin();
204 myScope = src.myScope;
205 myCurrentScope = src.myCurrentScope;
214 , myCurrentScope(scope)
218 myIterator = end ? dict->myTable.
end() : dict->myTable.
begin();
224 myIterator = dict->myTable.
begin();
225 if (!myIterator.atEnd())
230 myIterator = dict->myPrivateTable.
begin();
231 if (!myIterator.atEnd())
239 myGroupIterator = grouptable->
begin();
249 myGroupIterator = grouptable->
end();
254 myIterator = dict->myPrivateTable.
end();
262 myGroupIterator = end ? grouptable->
end() : grouptable->
begin();
264 myIterator = dict->myPrivateTable.
end();
269 myIterator = end ? dict->myPrivateTable.
end() : dict->myPrivateTable.
begin();
292 : myBegin(dict.
begin(scope))
293 , myEnd(dict.end(scope))
309 {
return Range(*
this, scope); }
313 const char *aname = (*a)->getName();
314 const char *bname = (*b)->getName();
315 if (!strcmp(aname,
"P"))
317 if (!strcmp(bname,
"P"))
330 {
return iterator(
this, scope,
false); }
332 {
return iterator(
this, scope,
true); }
348 template<
typename FUNCTOR>
352 if (!myTable.empty())
353 myTable.forEachValue(functor);
354 if (!myPrivateTable.empty())
355 myPrivateTable.forEachValue(functor);
357 if (grouptable && !grouptable->
empty())
360 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
365 template<
typename FUNCTOR>
370 myTable.forEachValue(functor);
372 myPrivateTable.forEachValue(functor);
376 if (grouptable && !grouptable->
empty())
379 functor(UTverify_cast<GA_ElementGroup*>(group)->getProxy().
get());
385 template<
typename FUNCTOR>
389 if (!myTable.empty())
395 if (!myPrivateTable.empty())
402 if (grouptable && !grouptable->
empty())
405 functor(UTverify_cast<GA_ElementGroup*>(group));
410 template<
typename FUNCTOR>
429 if (grouptable && !grouptable->
empty())
432 functor(UTverify_cast<GA_ElementGroup*>(group));
438 template<
typename FUNCTOR>
443 myTable.forEachKey(functor);
445 myPrivateTable.forEachKey(functor);
449 if (grouptable && !grouptable->
empty())
462 myTable.setNumBuckets(nbuckets);
464 myPrivateTable.setNumBuckets(nbuckets);
474 if (myTable.size()+n > myTable.bucket_count())
475 myTable.rehash(myTable.size()+
n);
479 if (myPrivateTable.size()+n > myPrivateTable.bucket_count())
480 myPrivateTable.rehash(myPrivateTable.size()+
n);
491 myTable.insert(std::make_pair(name, proxy));
493 myPrivateTable.insert(std::make_pair(name, proxy));
504 myPrivateTable.erase(name);
512 void bumpVersionParms() { myVersionParms++; }
514 exint numGroups()
const;
523 exint myVersionParms;
SYS_FORCE_INLINE void forEachAttribute(FUNCTOR &&functor) const
GLboolean GLboolean GLboolean b
Definition of a geometry attribute.
const char * name() const
Range(const GA_AttributeDict &dict, GA_AttributeScope scope)
SYS_FORCE_INLINE void forEachAttribute(GA_AttributeScope scope, FUNCTOR &&functor) const
SYS_FORCE_INLINE void forEachName(GA_AttributeScope scope, FUNCTOR &&functor) const
iterator end(GA_AttributeScope scope=GA_SCOPE_INVALID) const
iterator begin(GA_AttributeScope scope=GA_SCOPE_INVALID) const
UT_ArrayStringMap< GA_Group * >::const_iterator myGroupIterator
SYS_FORCE_INLINE void forEachValue(FUNCTOR &&functor) const
int64 getMemoryUsage(bool inclusive) const
Report memory usage.
GA_AttributeProxy * proxy() const
UT_ArrayStringMap< GA_Group * > MapType
GA_Attribute * attrib() const
exint entries(GA_AttributeScope scope) const
const iterator & operator=(const iterator &src)
GA_AttributeDict::iterator iterator
SYS_FORCE_INLINE void forEachKey(FUNCTOR &&functor) const
bool empty() const
Returns true iff there are no items in the set.
const GA_AttributeSet & getSet() 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)
GLuint const GLchar * name
Standard user attribute level.
const UT_StringHolder & getName() const
MapType::iterator map_iterator
UT_ArrayStringMap< GA_AttributeProxy * > MapType
ordered_iterator obegin(GA_AttributeScope scope=GA_SCOPE_INVALID) const
bool operator==(const iterator &cmp) const
GA_AttributeSet & getSet()
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
Parent::const_iterator const_iterator
GA_Attribute * operator*() const
Range range(GA_AttributeScope scope) const
This class holds a reference to an attribute. Such an indirection level allows an easy way to invalid...
GLboolean GLboolean GLboolean GLboolean a
iterator begin()
Returns a non-const iterator for the beginning of the set.
GA_Attribute * getAttribute()
GA_AttributeDict::iterator const_iterator
Parent::iterator iterator
Data has no numeric representation.
SYS_FORCE_INLINE const char * c_str() const
UT_OrderedIterator< GA_Attribute *, iterator > ordered_iterator
Iterator which traverses attributes in given order.
SYS_FORCE_INLINE void clear()
SYS_FORCE_INLINE void forEachProxy(GA_AttributeScope scope, FUNCTOR &&functor) const
bool empty(GA_AttributeScope scope) const
static int compareNumberedString(const char *s1, const char *s2, bool case_sensitive=true, bool allow_negatives=false)
ordered_iterator oend(GA_AttributeScope scope=GA_SCOPE_INVALID) const
MapType::const_iterator const_map_iterator
iterator(const iterator &src)
bool operator!=(const iterator &cmp) 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
static int compareAlpha(GA_Attribute *const *a, GA_Attribute *const *b)
GA_AttributeDict::const_map_iterator myIterator
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.