11 #ifndef __GT_DAIndexedDict__
12 #define __GT_DAIndexedDict__
29 return "GT_DAIndexedDict";
45 return myDictionaries.getMemoryUsage() +
46 sizeof(
int32)*mySize*myTupleSize;
48 return sizeof(
int32)*mySize*myTupleSize;
56 offset = offset*myTupleSize +
index;
63 offset = offset*myTupleSize +
index;
70 offset = offset*myTupleSize +
index;
77 offset = offset*myTupleSize +
index;
84 offset = offset*myTupleSize +
index;
91 offset = offset*myTupleSize +
index;
102 return myDictionaries.getItemIdUpperBound() + 1;
106 return getI32(offset, idx);
123 if (dict_idx >= 0 && (item = myDictionaries.get(dict_idx)))
125 MapKey key = item->
getKey();
138 freeDictionary(offset, index);
144 offset = offset * myTupleSize +
index;
146 myDictionaries.add(dict, NULL, &new_id);
148 myDictionaries.remove(old_id);
160 mySize * myTupleSize *
sizeof(
int32));
161 myDictionaries.clear();
165 for (
GT_Size i = size; i < mySize; ++i)
168 freeDictionary(i,
j);
171 myData = (
int32 *)GT_Memory::Realloc(
173 mySize * myTupleSize *
sizeof(
int32),
174 size * myTupleSize *
sizeof(
int32));
179 myData[i * myTupleSize +
j] = -1;
189 offset = offset*myTupleSize +
index;
190 if (myData[offset] >= 0)
192 myDictionaries.remove(myData[offset]);
201 MapKey(
const MapKey &
src) : myOpt(src.myOpt) {}
204 return myOpt ? myOpt.hash() : 123456789;
206 bool isEqual(
const MapKey &
src)
const
208 if (!myOpt || !src.myOpt)
209 return myOpt == src.myOpt;
211 return myOpt.isEqual(src.myOpt, 0.0);
222 return myOpt.options() < src.myOpt.options();
224 int64 getMemoryUsage(
bool inclusive)
const
226 int64 mem = inclusive ?
sizeof(*this) : 0;
227 mem += myOpt.getMemoryUsage(
true);
241 UT_IndexedDictMap myDictionaries;
void getIndexedStrings(UT_StringArray &, UT_IntArray &) const override
GT_DataArrayHandle harden() const override
Create a "hardened" version of the array.
GLsizei GLenum const void * indices
GT_Offset getDictIndex(GT_Offset offset, int idx) const override
fpreal64 getF64(GT_Offset offset, int index=0) const override
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
const KEY & getKey() const
const char * className() const override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
GT_String getS(GT_Offset, int) const override
Abstract data class for an array of float, int or string data.
UT_IntrusivePtr< GT_DataArray > GT_DataArrayHandle
GT_Type getTypeInfo() const override
Return "type" information for the data. This defaults to GT_TYPE_NONE.
static const UT_StringHolder theEmptyString
int64 getI64(GT_Offset offset, int index=0) const override
uint8 getU8(GT_Offset offset, int index=0) const override
static const UT_OptionsHolder theEmptyOptions
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
GT_Size getTupleSize() const override
Number of elements for each array element.
virtual void getIndexedDicts(UT_Array< UT_OptionsHolder > &dicts, UT_IntArray &indices) const =0
GT_Size entries() const override
Number of entries in the array.
GT_Size getDictIndexCount() const override
GT_Dict getDict(GT_Offset offset, int index=0) const override
int64 getMemoryUsage() const override
GT_Storage getStorage() const override
Type of data stored in the array.
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
fpreal32 getF32(GT_Offset offset, int index=0) const override
int32 getI32(GT_Offset offset, int index=0) const override
fpreal16 getF16(GT_Offset offset, int index=0) const override
GT_Size getStringIndexCount() const override
void setDict(GT_Size offset, int index, const GT_Dict &dict)
virtual int32 getI32(GT_Offset offset, int idx=0) const =0
int UT_IndexedHashMapItemId
Each item in the shared map is assigned a unique id.
GT_Offset getStringIndex(GT_Offset, int) const override