28 #ifndef __GABC_IGTArray__
29 #define __GABC_IGTArray__
39 template <
typename POD_T>
46 , myData(static_cast<const POD_T *>(array.
data()))
56 const POD_T *
data()
const {
return myData; }
64 {
return "GABC_IGTArray"; }
66 {
return GTstorage<POD_T>(); }
68 {
return myArray.gtType(); }
70 {
return myArray.tupleSize(); }
72 {
return myArray.entries(); }
76 +
sizeof(POD_T)*entries()*getTupleSize();
81 off = off * getTupleSize();
82 for (
int i = 0; i < sz; ++i)
83 buf[i] = myData[off+i];
88 off = off * getTupleSize();
89 for (
int i = 0; i < sz; ++i)
90 buf[i] = myData[off+i];
95 off = off * getTupleSize();
96 for (
int i = 0; i < sz; ++i)
97 buf[i] = myData[off+i];
102 off = off * getTupleSize();
103 for (
int i = 0; i < sz; ++i)
104 buf[i] = myData[off+i];
109 off = off * getTupleSize();
110 for (
int i = 0; i < sz; ++i)
111 buf[i] = myData[off+i];
116 off = off * getTupleSize();
117 for (
int i = 0; i < sz; ++i)
118 buf[i] = myData[off+i];
123 off = off * getTupleSize();
124 for (
int i = 0; i < sz; ++i)
125 buf[i] = myData[off+i];
131 off = off * getTupleSize();
132 for (
int i = 0; i < sz; ++i)
133 buf[i] = myData[off+i];
139 offset = offset * getTupleSize() +
index;
141 && offset<entries()*getTupleSize());
146 offset = offset * getTupleSize() +
index;
148 && offset<entries()*getTupleSize());
153 offset = offset * getTupleSize() +
index;
155 && offset<entries()*getTupleSize());
160 offset = offset * getTupleSize() +
index;
162 && offset<entries()*getTupleSize());
167 offset = offset * getTupleSize() +
index;
169 && offset<entries()*getTupleSize());
174 offset = offset * getTupleSize() +
index;
176 && offset<entries()*getTupleSize());
197 if (SYSisSame<POD_T, uint8>())
198 return reinterpret_cast<const uint8 *
>(
data());
203 if (SYSisSame<POD_T, int32>())
204 return reinterpret_cast<const int32 *
>(
data());
209 if (SYSisSame<POD_T, int64>())
210 return reinterpret_cast<const int64 *
>(
data());
215 if (SYSisSame<POD_T, fpreal16>())
221 if (SYSisSame<POD_T, fpreal32>())
227 if (SYSisSame<POD_T, fpreal64>())
233 { importTuple<uint8>(idx,
data,
size); }
235 { importTuple<int8>(idx,
data,
size); }
237 { importTuple<int16>(idx,
data,
size); }
239 { importTuple<int32>(idx,
data,
size); }
241 { importTuple<int64>(idx,
data,
size); }
243 { importTuple<fpreal16>(idx,
data,
size); }
245 { importTuple<fpreal32>(idx,
data,
size); }
247 { importTuple<fpreal64>(idx,
data,
size); }
250 int tsize,
int stride)
const override
251 { t_ABCFill(data, start, length, tsize, stride); }
253 int tsize,
int stride)
const override
254 { t_ABCFill(data, start, length, tsize, stride); }
256 int tsize,
int stride)
const override
257 { t_ABCFill(data, start, length, tsize, stride); }
259 int tsize,
int stride)
const override
260 { t_ABCFill(data, start, length, tsize, stride); }
262 int tsize,
int stride)
const override
263 { t_ABCFill(data, start, length, tsize, stride); }
265 int tsize,
int stride)
const override
266 { t_ABCFill(data, start, length, tsize, stride); }
268 int tsize,
int stride)
const override
269 { t_ABCFill(data, start, length, tsize, stride); }
271 int tsize,
int stride)
const override
272 { t_ABCFill(data, start, length, tsize, stride); }
276 template <
typename DEST_POD_T>
inline void
280 tsize = getTupleSize();
282 tsize =
SYSmin(tsize, getTupleSize());
283 const POD_T *
src = myData + idx*getTupleSize();
284 for (
int i = 0; i < tsize; ++i)
290 int tsize,
int stride)
const
293 tsize = getTupleSize();
294 stride =
SYSmax(stride, tsize);
295 int n =
SYSmin(tsize, getTupleSize());
296 if (n == getTupleSize() && stride == getTupleSize())
298 memcpy(dest, myData+start*getTupleSize(),
299 length*n*
sizeof(POD_T));
303 const POD_T *src = myData+start*getTupleSize();
307 exint rstart = r.begin();
308 exint rend = r.end();
309 POD_T *d = dest + rstart *
stride;
310 const POD_T *
s = src + rstart * getTupleSize();
311 for (
exint i = rstart;
313 ++i, s += getTupleSize(), d +=
stride)
315 for (
int j = 0;
j <
n; ++
j)
322 template <
typename DEST_POD_T>
inline void
324 int tsize,
int stride)
const
327 tsize = getTupleSize();
328 stride =
SYSmax(stride, tsize);
329 int n =
SYSmin(tsize, getTupleSize());
330 const POD_T *src = myData+start*getTupleSize();
334 exint rstart = r.begin();
335 exint rend = r.end();
336 DEST_POD_T *d = dest + rstart *
stride;
337 const POD_T *
s = src + rstart * getTupleSize();
338 for (
exint i = rstart;
340 ++i, s += getTupleSize(), d +=
stride)
342 for (
int j = 0;
j <
n; ++
j)
const void * getBackingData() const override
Provide virtual access to the underlying backing data.
GT_Size entries() const override
GLenum GLuint GLenum GLsizei const GLchar * buf
fpreal64 getF64(GT_Offset offset, int index=0) const override
void doImport(GT_Offset idx, uint8 *data, GT_Size size) const override
void doImport(GT_Offset idx, int16 *data, GT_Size size) const override
int64 getI64(GT_Offset offset, int index=0) const override
GABC_API GT_DataArrayHandle GABCarray(const GABC_IArray &iarray)
void doFillArray(int8 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
void doFillArray(fpreal32 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
const int64 * getI64Array(GT_DataArrayHandle &buffer) const override
void doImport(GT_Offset idx, fpreal32 *data, GT_Size size) const override
const fpreal32 * getF32Array(GT_DataArrayHandle &buffer) const override
GABC_IGTArray(const GABC_IArray &array)
GT_String getS(GT_Offset, int) const override
virtual const fpreal32 * getF32Array(GT_DataArrayHandle &buffer) const
GT_Type getTypeInfo() const override
const uint8 * getU8Array(GT_DataArrayHandle &buffer) const override
GLuint GLsizei GLsizei * length
int64 getMemoryUsage() const override
~GABC_IGTArray() override
void UTparallelForLightItems(const Range &range, const Body &body, const bool force_use_task_scope=true)
void doImport(GT_Offset idx, fpreal16 *data, GT_Size size) const override
virtual const fpreal64 * getF64Array(GT_DataArrayHandle &buffer) const
const char * className() const override
uint8 getU8(GT_Offset offset, int index=0) const override
void doFillArray(fpreal64 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
void doImport(GT_Offset idx, int8 *data, GT_Size size) const override
virtual const fpreal16 * getF16Array(GT_DataArrayHandle &buffer) const
void doFillArray(uint8 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
Abstract data class for an array of float, int or string data.
GT_Size getStringIndexCount() const override
const fpreal64 * getF64Array(GT_DataArrayHandle &buffer) const override
void doFillArray(fpreal16 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
static const UT_StringHolder theEmptyString
GLint GLenum GLboolean GLsizei stride
void doImport(GT_Offset idx, int32 *data, GT_Size size) const override
GT_Offset getDictIndex(GT_Offset, int) const override
const POD_T * data() const
Raw access to the data array.
void getIndexedDicts(UT_Array< UT_OptionsHolder > &, UT_IntArray &) const override
void getIndexedStrings(UT_StringArray &, UT_IntArray &) const override
fpreal16 getF16(GT_Offset offset, int index=0) const override
GABC_IGTStringArray(const GABC_IArray &array)
void doImport(GT_Offset idx, int64 *data, GT_Size size) const override
void doFillArray(int64 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
virtual const int64 * getI64Array(GT_DataArrayHandle &buffer) const
GT_Offset getStringIndex(GT_Offset, int) const override
void doFillArray(int32 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
fpreal32 getF32(GT_Offset offset, int index=0) const override
GT_Size getTupleSize() const override
const fpreal16 * getF16Array(GT_DataArrayHandle &buffer) const override
GT_Storage getStorage() const override
virtual const uint8 * getU8Array(GT_DataArrayHandle &buffer) const
void doImport(GT_Offset idx, fpreal64 *data, GT_Size size) const override
int32 getI32(GT_Offset offset, int index=0) const override
GT_Size getDictIndexCount() const override
void doFillArray(int16 *data, GT_Offset start, GT_Size length, int tsize, int stride) const override
const int32 * getI32Array(GT_DataArrayHandle &buffer) const override
~GABC_IGTStringArray() override
virtual const int32 * getI32Array(GT_DataArrayHandle &buffer) const