10 #ifndef __GA_BlobContainer__
11 #define __GA_BlobContainer__
22 template <
typename T>
class UT_Array;
28 #define GA_INVALID_BLOB_INDEX GA_BlobIndex(-1)
79 int64 getMemoryUsage(
bool inclusive)
const;
94 {
return myMap.getItemIdUpperBound()+1; }
98 {
return myMap.entries(); }
105 return myMap.getOccupancy();
125 return item ? item->
getKey().getBlob().get() :
nullptr;
141 item = myMap.getOrderedItem(index);
142 return item ? item->getKey().getBlob()
151 {
return myMap.findId(blob); }
169 {
return myMap.replaceItem(prevhandle, blob); }
196 { myMap.addReference(handle, inc); }
198 { addIndexReference(handle, 1); }
205 return myMap.getReferenceCount(handle);
211 {
return myMap.remove(handle); }
220 {
return myMap.remove(MapKey(blob)); }
249 {
return myMap.getItemIdUpperBound(); }
276 MapKey(
const MapKey &
src)
282 return myBlob ? myBlob->hash() : 123456789;
284 bool isEqual(
const MapKey &
src)
const
286 if (!myBlob || !src.myBlob)
287 return (myBlob && src.myBlob);
288 return myBlob->isEqual(*src.myBlob);
299 {
return myBlob.get() < src.myBlob.get(); }
301 int64 getMemoryUsage(
bool inclusive)
const
303 int64 mem = inclusive ?
sizeof(*this) : 0;
304 mem += myBlob->getMemoryUsage(
true);
void addIndexReference(GA_BlobIndex handle, int inc)
GA_BlobIndex getMaximumIndex() const
const KEY & getKey() const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void addIndexReference(GA_BlobIndex handle)
exint getIndexReferenceCount(GA_BlobIndex handle) const
UT_IndexedHashMapItemId GA_BlobIndex
std::string OIIO_UTIL_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
UT_IntrusivePtr< GA_BlobData > GA_BlobRef
bool freeBlob(GA_BlobIndex handle)
SYS_FORCE_INLINE const GA_BlobData * getRawBlob(GA_BlobIndex handle) const
SYS_FORCE_INLINE GA_BlobRef getBlob(GA_BlobIndex handle) const
GA_BlobIndex replaceBlob(GA_BlobIndex prevhandle, const GA_BlobRef &blob)
int UT_IndexedHashMapItemId
Each item in the shared map is assigned a unique id.
Container to store blobs of arbitrary data for attributes.
bool freeBlob(const GA_BlobRef &blob)
fpreal getOccupancy() const