GA_DataArrayTuple Class Reference

A tuple of scalar arrays. More...

#include <GA_DataArrayTuple.h>

List of all members.

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 () const
 Report memory usage.
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_Size array_size, const GA_Defaults &defs, ga_Packing packing=PACK_NONE)
 Setting the tuple size requires the array_size and the defaults.
void setArraySize (GA_Size size)
 This method grows each array of the tuple.
GA_Size getArraySize () const
 This method queries the (common) size of the arrays.
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 UT_Options *options) const
bool jsonLoad (UT_JSONParser &w, const GA_LoadMap &map, GA_AttributeOwner owner)
 Load from a JSON stream.
bool jsonSave (UT_JSONWriter &w, const GA_Range &range, const UT_Options *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 *const * getDataPtr () const
GA_DataArray *const * getDataPtr ()

Static Public Member Functions

static bool jsonSave (UT_JSONWriter &w, const GA_Range &it, const UT_Options *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 UT_Options *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_Size 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 52 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 61 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_Size  length,
const GA_Defaults defs 
) [protected]

void GA_DataArrayTuple::comparePages ( UT_BitArray pages,
const GA_DataArrayTuple other 
) const

void GA_DataArrayTuple::defragment ( const GA_Defragment defrag  ) 

Interface for defragmentation

GA_Size GA_DataArrayTuple::getArraySize (  )  const

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

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

Definition at line 108 of file GA_DataArrayTuple.h.

GA_DataArray* GA_DataArrayTuple::getData ( int  tuple_index  )  [inline]

Definition at line 102 of file GA_DataArrayTuple.h.

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

Access to data as arrays of tuples

Definition at line 123 of file GA_DataArrayTuple.h.

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

Access to data as arrays of tuples

Definition at line 122 of file GA_DataArrayTuple.h.

int64 GA_DataArrayTuple::getMemoryUsage (  )  const

Report memory usage.

ga_Packing GA_DataArrayTuple::getPacking (  )  const [inline]

Definition at line 101 of file GA_DataArrayTuple.h.

GA_Storage GA_DataArrayTuple::getStorage (  )  const [inline]

Definition at line 99 of file GA_DataArrayTuple.h.

int GA_DataArrayTuple::getTupleSize (  )  const [inline]

Definition at line 100 of file GA_DataArrayTuple.h.

bool GA_DataArrayTuple::isSharedArray ( int  idx  )  const [protected]

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::jsonLoad ( UT_JSONParser w,
const GA_LoadMap map,
GA_AttributeOwner  owner 
)

Load from a JSON stream.

static bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range range,
const UT_Options 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]

bool GA_DataArrayTuple::jsonSave ( UT_JSONWriter w,
const GA_Range range,
const UT_Options 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 it,
const UT_Options 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 it,
const UT_Options 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",
                                 "fpreal16", "fpreal32", "fpreal64" ],
         },
         "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

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_Size  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_Size  array_size,
const GA_Defaults defs,
ga_Packing  packing = PACK_NONE 
)

Setting the tuple size requires the array_size and the defaults.


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

Generated on Thu Jan 31 00:30:41 2013 for HDK by  doxygen 1.5.9