HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_ArrayDataArray Class Reference

An array of array of numbers with various storage types. More...

#include <GA_ArrayDataArray.h>

Public Member Functions

 GA_ArrayDataArray (GA_Storage storage, int tuplesize)
 
 GA_ArrayDataArray (const GA_ArrayDataArray &src)
 
 ~GA_ArrayDataArray ()
 
GA_ArrayDataArrayoperator= (const GA_ArrayDataArray &src)
 
int64 getMemoryUsage (bool inclusive) const
 Report memory usage. More...
 
void countMemory (UT_MemoryCounter &counter, bool inclusive) const
 
void setArraySize (GA_Offset size)
 Change the size of the array. More...
 
GA_Offset getArraySize () const
 Query the size of the array. More...
 
exint findMaximumArrayLength () const
 
GA_Storage getStorage () const
 Query the storage used for the array data. More...
 
void setStorage (GA_Storage newstorage)
 Changes the storage, copying the data to the new format. More...
 
GA_Size getTupleSize () const
 Queries the size of each tuple stored in the arrays. More...
 
void setTupleSize (GA_Size size)
 
void clear ()
 Empties the array, creating an empty array. More...
 
void clearOffset (GA_Offset off, GA_Size num)
 Empties a specific subset of the array, [off, off+num) More...
 
void mergeGrowArrayAndCopy (const GA_MergeMap &map, GA_AttributeOwner owner, const GA_ArrayDataArray &src)
 
void reset (GA_Offset di)
 Clear the particular indices to empty arrays. More...
 
void reset (const GA_Range &di)
 
void copy (GA_Offset di, const GA_ArrayDataArray *src, GA_Offset si)
 Copies. More...
 
void copy (GA_Range di, const GA_ArrayDataArray *src, GA_Range si)
 
exint arraySize (GA_Offset offset) const
 Return the array size for a given offset. More...
 
void get (GA_Offset off, UT_Array< fpreal32 > &values) const
 
void get (GA_Offset off, UT_Array< fpreal64 > &values) const
 
void get (GA_Offset off, UT_Array< int32 > &values) const
 
void get (GA_Offset off, UT_Array< int64 > &values) const
 
void append (GA_Offset off, UT_PackedArrayOfArrays< fpreal32 > &values) const
 
void append (GA_Offset off, UT_PackedArrayOfArrays< fpreal64 > &values) const
 
void append (GA_Offset off, UT_PackedArrayOfArrays< int32 > &values) const
 
void append (GA_Offset off, UT_PackedArrayOfArrays< int64 > &values) const
 
 GETBLOCKFROMINDEX (int32, int32)
 
 GETBLOCKFROMINDEX (int32, int64)
 
 GETBLOCKFROMINDEX (int32, fpreal32)
 
 GETBLOCKFROMINDEX (int32, fpreal64)
 
 GETBLOCKFROMINDEX (int64, int32)
 
 GETBLOCKFROMINDEX (int64, int64)
 
 GETBLOCKFROMINDEX (int64, fpreal32)
 
 GETBLOCKFROMINDEX (int64, fpreal64)
 
void set (GA_Offset off, const UT_Array< fpreal32 > &values)
 
void set (GA_Offset off, const UT_Array< fpreal64 > &values)
 
void set (GA_Offset off, const UT_Array< int32 > &values)
 
void set (GA_Offset off, const UT_Array< int64 > &values)
 
bool jsonSave (UT_JSONWriter &w, const GA_Range &it) const
 
bool jsonLoad (UT_JSONParser &p, const GA_LoadMap &map, GA_AttributeOwner owner)
 Load from a JSON stream. More...
 
bool jsonSave (UT_JSONWriter &w, const GA_Range &range, const UT_IntArray *map, int defvalue=-1) const
 
bool isSameType (const GA_ArrayDataArray &b) const
 
void tryCompressAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)
 
void tryCompressSinglePage (GA_Offset pageoffset)
 
void hardenAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)
 
void remapAndCount (GA_Offset start_offset, GA_Offset end_offset, const UT_IntArray &old2new, UT_IntArray &count)
 
void swapRange (GA_Offset a, GA_Offset b, GA_Size n)
 
void moveRange (GA_Offset src, GA_Offset dest, GA_Size n)
 
void defragment (const GA_Defragment &defrag)
 

Detailed Description

An array of array of numbers with various storage types.

GA_ArrayDataArray provides a way of storing arrays of tuples of scalar values. The array can have various storage types from 8-bit integer to 64-bit reals.

Definition at line 44 of file GA_ArrayDataArray.h.

Constructor & Destructor Documentation

GA_ArrayDataArray::GA_ArrayDataArray ( GA_Storage  storage,
int  tuplesize 
)
GA_ArrayDataArray::GA_ArrayDataArray ( const GA_ArrayDataArray src)
GA_ArrayDataArray::~GA_ArrayDataArray ( )

Member Function Documentation

void GA_ArrayDataArray::append ( GA_Offset  off,
UT_PackedArrayOfArrays< fpreal32 > &  values 
) const
void GA_ArrayDataArray::append ( GA_Offset  off,
UT_PackedArrayOfArrays< fpreal64 > &  values 
) const
void GA_ArrayDataArray::append ( GA_Offset  off,
UT_PackedArrayOfArrays< int32 > &  values 
) const
void GA_ArrayDataArray::append ( GA_Offset  off,
UT_PackedArrayOfArrays< int64 > &  values 
) const
exint GA_ArrayDataArray::arraySize ( GA_Offset  offset) const

Return the array size for a given offset.

void GA_ArrayDataArray::clear ( )

Empties the array, creating an empty array.

void GA_ArrayDataArray::clearOffset ( GA_Offset  off,
GA_Size  num 
)

Empties a specific subset of the array, [off, off+num)

void GA_ArrayDataArray::copy ( GA_Offset  di,
const GA_ArrayDataArray src,
GA_Offset  si 
)

Copies.

void GA_ArrayDataArray::copy ( GA_Range  di,
const GA_ArrayDataArray src,
GA_Range  si 
)
void GA_ArrayDataArray::countMemory ( UT_MemoryCounter counter,
bool  inclusive 
) const

Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. If inclusive is true, the size of this object is counted, else only memory owned by this object is counted. If this is pointed to by the calling object, inclusive should be true. If this is contained in the calling object, inclusive should be false. (Its memory was already counted in the size of the calling object.)

void GA_ArrayDataArray::defragment ( const GA_Defragment defrag)

Interface for defragmentation

exint GA_ArrayDataArray::findMaximumArrayLength ( ) const

The maximum length of any of our sub-arrays, requries running over the entire array

void GA_ArrayDataArray::get ( GA_Offset  off,
UT_Array< fpreal32 > &  values 
) const

Read/Write individual elements If you have tuplesize 3, the values will be multiple of 3!

void GA_ArrayDataArray::get ( GA_Offset  off,
UT_Array< fpreal64 > &  values 
) const
void GA_ArrayDataArray::get ( GA_Offset  off,
UT_Array< int32 > &  values 
) const
void GA_ArrayDataArray::get ( GA_Offset  off,
UT_Array< int64 > &  values 
) const
GA_Offset GA_ArrayDataArray::getArraySize ( ) const
inline

Query the size of the array.

Definition at line 70 of file GA_ArrayDataArray.h.

GA_ArrayDataArray::GETBLOCKFROMINDEX ( int32  ,
int32   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int32  ,
int64   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int32  ,
fpreal32   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int32  ,
fpreal64   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int64  ,
int32   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int64  ,
int64   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int64  ,
fpreal32   
)
GA_ArrayDataArray::GETBLOCKFROMINDEX ( int64  ,
fpreal64   
)
int64 GA_ArrayDataArray::getMemoryUsage ( bool  inclusive) const

Report memory usage.

GA_Storage GA_ArrayDataArray::getStorage ( ) const

Query the storage used for the array data.

GA_Size GA_ArrayDataArray::getTupleSize ( ) const

Queries the size of each tuple stored in the arrays.

void GA_ArrayDataArray::hardenAllPages ( GA_Offset  start_offset = GA_Offset(0),
GA_Offset  end_offset = GA_INVALID_OFFSET 
)

Harden data pages Will harden all pages overlapping the specified offset range.

bool GA_ArrayDataArray::isSameType ( const GA_ArrayDataArray b) const
inline

Definition at line 184 of file GA_ArrayDataArray.h.

bool GA_ArrayDataArray::jsonLoad ( UT_JSONParser p,
const GA_LoadMap map,
GA_AttributeOwner  owner 
)

Load from a JSON stream.

bool GA_ArrayDataArray::jsonSave ( UT_JSONWriter w,
const GA_Range it 
) const

Save data to a JSON stream.

JSON Schema: GA_DataArray

{
"name" : "GA_ArrayDataArray",
"description" : "An array of arrays of numbers",
"type" : "array",
"items" : "number",
}
See Also
JSON_FileFormat
bool GA_ArrayDataArray::jsonSave ( UT_JSONWriter w,
const GA_Range range,
const UT_IntArray map,
int  defvalue = -1 
) const

Save with an integer translation. This method is just like the standard jsonSave() method. However each value is used as an index into the integer array. The value stored in the array is written instead of the raw value.

for (GA_Iterator it(range); !it.atEnd(); ++it) {
idx = getInteger(it.getOffset());
json.write( idx < 0 || idx >= map.entries() ? -1 : map(idx) );
}
void GA_ArrayDataArray::mergeGrowArrayAndCopy ( const GA_MergeMap map,
GA_AttributeOwner  owner,
const GA_ArrayDataArray src 
)

mergeGrowArrayAndCopy() is called to grow the data array while copying data from the source.

void GA_ArrayDataArray::moveRange ( GA_Offset  src,
GA_Offset  dest,
GA_Size  n 
)

Interface for defragmentation

GA_ArrayDataArray& GA_ArrayDataArray::operator= ( const GA_ArrayDataArray src)
void GA_ArrayDataArray::remapAndCount ( GA_Offset  start_offset,
GA_Offset  end_offset,
const UT_IntArray old2new,
UT_IntArray count 
)

Remaps all numbers through the lookup table. Negative numbers get mapped to -1. Counts the number of occurrences of each number in the counter, which should be pre-allocated to your maximum size. Inclusive count measures the source indices, not destination.

void GA_ArrayDataArray::reset ( GA_Offset  di)

Clear the particular indices to empty arrays.

void GA_ArrayDataArray::reset ( const GA_Range di)
void GA_ArrayDataArray::set ( GA_Offset  off,
const UT_Array< fpreal32 > &  values 
)

For efficiency, should already have set the length. If a resize is forced, will convert the touched page to POINTERS

void GA_ArrayDataArray::set ( GA_Offset  off,
const UT_Array< fpreal64 > &  values 
)
void GA_ArrayDataArray::set ( GA_Offset  off,
const UT_Array< int32 > &  values 
)
void GA_ArrayDataArray::set ( GA_Offset  off,
const UT_Array< int64 > &  values 
)
void GA_ArrayDataArray::setArraySize ( GA_Offset  size)

Change the size of the array.

void GA_ArrayDataArray::setStorage ( GA_Storage  newstorage)

Changes the storage, copying the data to the new format.

void GA_ArrayDataArray::setTupleSize ( GA_Size  size)

Adjusts the tuple size, note this does not affect the actual data layout!

void GA_ArrayDataArray::swapRange ( GA_Offset  a,
GA_Offset  b,
GA_Size  n 
)

Interface for defragmentation

void GA_ArrayDataArray::tryCompressAllPages ( GA_Offset  start_offset = GA_Offset(0),
GA_Offset  end_offset = GA_INVALID_OFFSET 
)

Try to compress data pages Will try to compress all pages overlapping the specified offset range.

void GA_ArrayDataArray::tryCompressSinglePage ( GA_Offset  pageoffset)

Compresses a specific page. Pass in the offset whose page you wish to compress, not the page id.


The documentation for this class was generated from the following file: