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

A tuple of scalar arrays. More...

#include <GA_DataArrayTuple.h>

Public Types

enum  ga_Packing { PACK_NONE, PACK_VECTOR3 }
 

Public Member Functions

 GA_DataArrayTuple (GA_Storage storage)
 
 GA_DataArrayTuple (const GA_DataArrayTuple &src)
 
 ~GA_DataArrayTuple ()
 
int64 getMemoryUsage (bool inclusive) const
 Report memory usage. More...
 
void countMemory (UT_MemoryCounter &counter, bool inclusive) const
 
GA_DataArrayTupleoperator= (const GA_DataArrayTuple &src)
 
void setStorage (GA_Storage storage, const GA_Range &copy_iterator, const GA_Defaults &defs, bool allow_packing=false)
 
void setTupleSize (int tuple_size, GA_Offset array_size, const GA_Defaults &defs, ga_Packing packing=PACK_NONE)
 Setting the tuple size requires the array_size and the defaults. More...
 
void setArraySize (GA_Offset size)
 This method grows each array of the tuple. More...
 
GA_Offset getArraySize () const
 This method queries the (common) size of the arrays. More...
 
void tryCompressAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)
 
void hardenAllPages (GA_Offset start_offset=GA_Offset(0), GA_Offset end_offset=GA_INVALID_OFFSET)
 
void mergeGrowArrayAndCopy (const GA_MergeMap &map, GA_AttributeOwner owner, const GA_DataArrayTuple &src)
 
GA_Storage getStorage () const
 
int getTupleSize () const
 
ga_Packing getPacking () const
 
GA_DataArraygetData (int tuple_index)
 
const GA_DataArraygetData (int tuple_index) const
 
bool jsonSave (UT_JSONWriter &w, const GA_Range &it, const GA_SaveOptions *options) const
 
bool jsonLoad (UT_JSONParser &w, const GA_LoadMap &map, GA_AttributeOwner owner)
 Load from a JSON stream. More...
 
bool jsonSave (UT_JSONWriter &w, const GA_Range &range, const GA_SaveOptions *options, const UT_IntArray *map, int defvalue=-1) const
 
void comparePages (UT_BitArray &pages, const GA_DataArrayTuple &other) const
 
void defragment (const GA_Defragment &defrag)
 
const GA_DataArray *constgetDataPtr () const
 
GA_DataArray *constgetDataPtr ()
 

Static Public Member Functions

static bool jsonSave (UT_JSONWriter &w, const GA_Range &it, const GA_SaveOptions *options, const GA_DataArray *const *data, int data_tuple_size, GA_Storage data_storage, ga_Packing data_packing)
 
static bool jsonLoad (UT_JSONParser &w, const GA_LoadMap &map, GA_AttributeOwner owner, GA_DataArray *const *data, int data_tuple_size, GA_Storage data_storage, ga_Packing data_packing)
 
static bool jsonSave (UT_JSONWriter &w, const GA_Range &range, const GA_SaveOptions *options, const UT_IntArray *map, int defvalue, const GA_DataArray *const *data, int data_tuple_size, GA_Storage data_storage, ga_Packing data_packing)
 

Protected Member Functions

GA_DataArraybuildDataArray (int idx, GA_Offset length, const GA_Defaults &defs)
 
bool isSharedArray (int idx) const
 

Detailed Description

A tuple of scalar arrays.

This class maintains a tuple of arrays. For example storing a position is kept as three distinct arrays (one for x, y and z). The storage for all arrays is uniform.

See also: JSON Schema: GA_DataArrayTuple

See Also
GA_DataArray

Definition at line 49 of file GA_DataArrayTuple.h.

Member Enumeration Documentation

Regardless of packing, we always have one GA_DataArray for each of our tuple_size components. Packing causes the first set of these data arrays to share data tables and store their actual data in an interleaved format. If tuplesize is larger than the packing size, the extra components are normal arrays, so P + Pw works as expected with a PACK_VECTOR3

Enumerator
PACK_NONE 
PACK_VECTOR3 

Definition at line 58 of file GA_DataArrayTuple.h.

Constructor & Destructor Documentation

GA_DataArrayTuple::GA_DataArrayTuple ( GA_Storage  storage)
GA_DataArrayTuple::GA_DataArrayTuple ( const GA_DataArrayTuple src)
GA_DataArrayTuple::~GA_DataArrayTuple ( )

Member Function Documentation

GA_DataArray* GA_DataArrayTuple::buildDataArray ( int  idx,
GA_Offset  length,
const GA_Defaults defs 
)
protected
void GA_DataArrayTuple::comparePages ( UT_BitArray pages,
const GA_DataArrayTuple other 
) const
void GA_DataArrayTuple::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_DataArrayTuple::defragment ( const GA_Defragment defrag)

Interface for defragmentation

GA_Offset GA_DataArrayTuple::getArraySize ( ) const

This method queries the (common) size of the arrays.

GA_DataArray* GA_DataArrayTuple::getData ( int  tuple_index)
inline

Definition at line 120 of file GA_DataArrayTuple.h.

const GA_DataArray* GA_DataArrayTuple::getData ( int  tuple_index) const
inline

Definition at line 126 of file GA_DataArrayTuple.h.

const GA_DataArray* const* GA_DataArrayTuple::getDataPtr ( ) const
inline

Access to data as arrays of tuples

Definition at line 140 of file GA_DataArrayTuple.h.

GA_DataArray* const* GA_DataArrayTuple::getDataPtr ( )
inline

Access to data as arrays of tuples

Definition at line 141 of file GA_DataArrayTuple.h.

int64 GA_DataArrayTuple::getMemoryUsage ( bool  inclusive) const

Report memory usage.

ga_Packing GA_DataArrayTuple::getPacking ( ) const
inline

Definition at line 119 of file GA_DataArrayTuple.h.

GA_Storage GA_DataArrayTuple::getStorage ( ) const
inline

Definition at line 117 of file GA_DataArrayTuple.h.

int GA_DataArrayTuple::getTupleSize ( ) const
inline

Definition at line 118 of file GA_DataArrayTuple.h.

void GA_DataArrayTuple::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_DataArrayTuple::isSharedArray ( int  idx) const
protected
bool GA_DataArrayTuple::jsonLoad ( UT_JSONParser w,
const GA_LoadMap map,
GA_AttributeOwner  owner 
)

Load from a JSON stream.

static bool GA_DataArrayTuple::jsonLoad ( UT_JSONParser w,
const GA_LoadMap map,
GA_AttributeOwner  owner,
GA_DataArray *const data,
int  data_tuple_size,
GA_Storage  data_storage,
ga_Packing  data_packing 
)
static
bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range it,
const GA_SaveOptions options 
) const

Save data to JSON schema.

JSON Schema: GA_DataArrayTuple

The data values are stored as an array of structs. That is, if the DataArrayTuple is a 2-vector (tuple size 2) containing 4 elements, the value array will be an array of 4 2-vectors (i.e. [ [0,0], [1,1], [2,2], [3,3] ]). For single valued (tuple size == 1), a single array of values is saved out. The keyword for this is "arrays" vs. "tuples".

{
"name" : "GA_DataArrayTuple",
"description : "A tuple of scalar arrays",
"type" : "orderedmap",
"properties" :
{
"size": {
"type" : "integer",
"minimum" : 1,
},
"storage": {
"type" : "string",
"enum" : [ "uint8","int8","int16","int32","int64",
},
"tuples": {
"type" : "array",
"description" :
"Saved as an array of structs (not a struct of arrays)."
"items" : {
"description" :
"Each item is a number array for each tuple",
"type" : "array"
"items" : "number",
}
}
"arrays": {
"type" : "array",
"description" :
"For scalars, just save out the single GA_DataArray",
"items" : { "$ref":"GA_DataArray" }
}
}
}
See Also
JSON_FileFormat
static bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range it,
const GA_SaveOptions options,
const GA_DataArray *const data,
int  data_tuple_size,
GA_Storage  data_storage,
ga_Packing  data_packing 
)
static
bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range range,
const GA_SaveOptions options,
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) );
}
See Also
GA_DataArray::jsonSave()
static bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range range,
const GA_SaveOptions options,
const UT_IntArray map,
int  defvalue,
const GA_DataArray *const data,
int  data_tuple_size,
GA_Storage  data_storage,
ga_Packing  data_packing 
)
static
void GA_DataArrayTuple::mergeGrowArrayAndCopy ( const GA_MergeMap map,
GA_AttributeOwner  owner,
const GA_DataArrayTuple src 
)
GA_DataArrayTuple& GA_DataArrayTuple::operator= ( const GA_DataArrayTuple src)
void GA_DataArrayTuple::setArraySize ( GA_Offset  size)

This method grows each array of the tuple.

void GA_DataArrayTuple::setStorage ( GA_Storage  storage,
const GA_Range copy_iterator,
const GA_Defaults defs,
bool  allow_packing = false 
)

Changing the storage requires a copy iterator which accesses each and every element of the array and the defaults The allow_packing parameter should be set if the attribute allows it.

void GA_DataArrayTuple::setTupleSize ( int  tuple_size,
GA_Offset  array_size,
const GA_Defaults defs,
ga_Packing  packing = PACK_NONE 
)

Setting the tuple size requires the array_size and the defaults.

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

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


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