GA_Attribute Class Reference

Definition of a geometry attribute. More...

#include <GA_Attribute.h>

Inheritance diagram for GA_Attribute:

GA_ATIBlindData GA_ATIBlob GA_ATIGBPoint GA_ATIGroupBool GA_ATIIndexPair GA_ATINumeric GA_ATITopology GA_ATIString

List of all members.

Public Types

enum  WriteConcurrence { WRITE_CONCURRENCE_NONE, WRITE_CONCURRENCE_PAGE, WRITE_CONCURRENCE_ELEMENT }

Public Member Functions

 GA_Attribute (const GA_AttributeType &type, const GA_IndexMap &index_map, GA_AttributeScope scope, const char *name)
virtual ~GA_Attribute ()
const GA_AttributeTypegetType () const
const GA_IndexMapgetIndexMap () const
const GA_DetailgetDetail () const
GA_AttributeOwner getOwner () const
GA_AttributeScope getScope () const
GA_TypeInfo getTypeInfo () const
bool setTypeInfo (GA_TypeInfo type)
GA_StorageClass getStorageClass () const
 Returns the approximate type of the attribute.
int getTupleSize () const
 Size of the AIFTuple, if it exists. If it doesn't, 1.
const char * getName () const
const char * getFullName () const
bool setArraySize (GA_Size size)
virtual WriteConcurrence getSupportedWriteConcurrence () const =0
virtual const GA_AIFCopyDatagetAIFCopyData () const
 Return the attribute's copy interface or NULL.
virtual const GA_AIFDeltagetAIFDelta () const
 Return the attribute's delta interface or NULL.
virtual const GA_AIFTuplegetAIFTuple () const
 Return the attribute's tuple interface or NULL.
virtual const GA_AIFMathgetAIFMath () const
 Return the attribute's math interface or NULL.
virtual const GA_AIFMergegetAIFMerge () const
 Return the attribute's merge interface or NULL.
virtual const GA_AIFInterpgetAIFInterp () const
 Return the attribute's interpolation interface or NULL.
virtual const GA_AIFBlobgetAIFBlob () const
 Return the attribute's blob interface or NULL.
virtual const GA_AIFStringTuplegetAIFStringTuple () const
 Return the attribute's string tuple interface or NULL.
virtual const
GA_AIFSharedStringTuple
getAIFSharedStringTuple () const
 Return the attribute's shared string tuple interface or NULL.
virtual const GA_AIFIndexPairgetAIFIndexPair () const
 Return the attribute's index pair interface or NULL.
virtual const GA_AIFBlindDatagetAIFBlindData () const
 Return the attribute's blind data interface or NULL.
virtual const GA_AIFEditgetAIFEdit () const
 Return the attribute's edit interface or NULL.
virtual const GA_AIFComparegetAIFCompare () const
 Return the attribute's comparison interface or NULL.
virtual const GA_AIFStatgetAIFStat () const
const UT_OptionsgetOptions () const
UT_OptionsgetOptions ()
bool needsTransform (bool include_P=true) const
void mergeOptions (const UT_Options &src)
 Merge the options passed in with the options in the attribute.
bool importOption (const char *name, int &v) const
bool importOption (const char *name, bool &v) const
bool importOption (const char *name, fpreal32 &v) const
bool importOption (const char *name, fpreal64 &v) const
bool importOption (const char *name, UT_String &v) const
virtual bool needDestruction () const
 Methods which can be overridden from GA_Attribute.
virtual void destructElement (GA_Offset offset)
 Callback invoked if needsDestruction() returns true.
void setTailInitialization (bool onoff)
bool isTailInitialization () const
 Check whether the attribute is set to tail initialization.
virtual void reconstructElement (GA_Offset offset)
virtual void compactStorage ()
virtual void batchDeletion ()
GA_Attributeclone (const GA_IndexMap &index_map, const char *name, bool clone_options) const
bool jsonSaveDefinition (UT_JSONWriter &w) const
 Save the GA_Attribute-Definition section.
virtual const GA_AIFJSONgetAIFJSON () const
 Return the AIF to handle saving/loading of the private data section.
virtual int getSaveVersion () const
virtual bool debugValidateArrayCapacity (GA_Size sz) const
 Debug validation of allocated array size.
virtual int64 getMemoryUsage () const =0
 Report the memory usage.
virtual void defragment (const GA_Defragment &defrag)=0
GA_AttributeProxyHandle getProxy ()
GA_ConstAttributeProxyHandle getProxy () const
bool isNonTransforming () const
void setNonTransforming (bool val)

Static Public Member Functions

static bool jsonLoadDefinition (UT_JSONParser &p, GA_AttributeScope &scope, UT_WorkBuffer &type, UT_WorkBuffer &name, int64 &version, UT_Options &options)
 Load the GA_Attribute-Definition section.

Protected Member Functions

virtual bool changeArraySize (GA_Size new_size)=0

Friends

GA_AttributeGA_AttributeType::create (const GA_IndexMap &, GA_AttributeScope, const char *, const UT_Options *, const UT_Options *) const
class GA_AttributeSet
class GA_MergeMap


Detailed Description

Definition of a geometry attribute.

An attribute can be attached to points, vertices, primitives or the detail itself. The attribute is responsible for maintaining the data array.

See also:
Iterators for implications of paged allocation strategies.
The attribute is responsible for providing interfaces (AIF).
Examples:

field3d/f3d_io.C, SOP/SOP_PrimVOP.C, and VRAY/VRAY_DemoSprite.C.

Definition at line 64 of file GA_Attribute.h.


Member Enumeration Documentation

The various concurrency levels supported by attributes for writing per-element data.

Enumerator:
WRITE_CONCURRENCE_NONE  No concurrent writes supported.
WRITE_CONCURRENCE_PAGE  Concurrent writes to separate pages supported.
WRITE_CONCURRENCE_ELEMENT  Concurrent writes to separate elements supported.

Definition at line 113 of file GA_Attribute.h.


Constructor & Destructor Documentation

GA_Attribute::GA_Attribute ( const GA_AttributeType type,
const GA_IndexMap index_map,
GA_AttributeScope  scope,
const char *  name 
)

virtual GA_Attribute::~GA_Attribute (  )  [virtual]


Member Function Documentation

virtual void GA_Attribute::batchDeletion (  )  [virtual]

This method is called before a batch deletion operation. It allows the attribute to mark objects as dirty so that there can be lazy computation of data. For example, re-computing the number of elements in a group. This method may be called multiple times, and so should typically just set a flag (not perform a lot of computation).

virtual bool GA_Attribute::changeArraySize ( GA_Size  new_size  )  [protected, pure virtual]

Event methods to handle changes to the attribute The method to change array size *must* be implemented in subclasses

Return true if the attribute was resized.

Implemented in GA_ATIBlindData, GA_ATIBlob, GA_ATIGBPoint, GA_ATIGroupBool, GA_ATIIndexPair, GA_ATINumeric, and GA_ATITopology.

GA_Attribute* GA_Attribute::clone ( const GA_IndexMap index_map,
const char *  name,
bool  clone_options 
) const

This method returns a new attribute of the same type with identical settings. Attribute data is not copied. Derived classes implement this method by overriding the virtual doClone(). Those classes not supporting cloning are permitted to return NULL.

virtual void GA_Attribute::compactStorage (  )  [virtual]

A method to "compact" any storage. For example, if there's a string table associated with the attribute, this gives the attribute the option to adjust the table to be more compact.

Reimplemented in GA_ATIBlob.

virtual bool GA_Attribute::debugValidateArrayCapacity ( GA_Size  sz  )  const [virtual]

Debug validation of allocated array size.

Reimplemented in GA_ATIGroupBool, GA_ATINumeric, and GA_ATIString.

virtual void GA_Attribute::defragment ( const GA_Defragment defrag  )  [pure virtual]

defragment() defragments the memory used to store data elements

Implemented in GA_ATIBlindData, GA_ATIBlob, GA_ATIGBPoint, GA_ATIGroupBool, GA_ATIIndexPair, GA_ATINumeric, and GA_ATITopology.

virtual void GA_Attribute::destructElement ( GA_Offset  offset  )  [virtual]

Callback invoked if needsDestruction() returns true.

Reimplemented in GA_ATIBlob, and GA_ATIGroupBool.

virtual const GA_AIFBlindData* GA_Attribute::getAIFBlindData (  )  const [virtual]

Return the attribute's blind data interface or NULL.

Reimplemented in GA_ATIBlindData.

virtual const GA_AIFBlob* GA_Attribute::getAIFBlob (  )  const [virtual]

Return the attribute's blob interface or NULL.

Reimplemented in GA_ATIBlob.

virtual const GA_AIFCompare* GA_Attribute::getAIFCompare (  )  const [virtual]

Return the attribute's comparison interface or NULL.

Reimplemented in GA_ATIBlindData, GA_ATIBlob, GA_ATIIndexPair, and GA_ATINumeric.

virtual const GA_AIFCopyData* GA_Attribute::getAIFCopyData (  )  const [virtual]

Return the attribute's copy interface or NULL.

Reimplemented in GA_ATIBlindData, GA_ATIBlob, GA_ATIGroupBool, GA_ATIIndexPair, and GA_ATINumeric.

virtual const GA_AIFDelta* GA_Attribute::getAIFDelta (  )  const [virtual]

Return the attribute's delta interface or NULL.

Reimplemented in GA_ATINumeric.

virtual const GA_AIFEdit* GA_Attribute::getAIFEdit (  )  const [virtual]

Return the attribute's edit interface or NULL.

Reimplemented in GA_ATIIndexPair, and GA_ATINumeric.

virtual const GA_AIFIndexPair* GA_Attribute::getAIFIndexPair (  )  const [virtual]

Return the attribute's index pair interface or NULL.

Reimplemented in GA_ATIIndexPair.

virtual const GA_AIFInterp* GA_Attribute::getAIFInterp (  )  const [virtual]

Return the attribute's interpolation interface or NULL.

Reimplemented in GA_ATIBlob, GA_ATIGroupBool, GA_ATIIndexPair, and GA_ATINumeric.

virtual const GA_AIFJSON* GA_Attribute::getAIFJSON (  )  const [virtual]

Return the AIF to handle saving/loading of the private data section.

Reimplemented in GA_ATIBlindData, GA_ATIIndexPair, GA_ATINumeric, and GA_ATIString.

virtual const GA_AIFMath* GA_Attribute::getAIFMath (  )  const [virtual]

Return the attribute's math interface or NULL.

Reimplemented in GA_ATIIndexPair, and GA_ATINumeric.

virtual const GA_AIFMerge* GA_Attribute::getAIFMerge (  )  const [virtual]

Return the attribute's merge interface or NULL.

Reimplemented in GA_ATIBlindData, GA_ATIBlob, GA_ATIGroupBool, GA_ATIIndexPair, GA_ATINumeric, and GA_ATITopology.

virtual const GA_AIFSharedStringTuple* GA_Attribute::getAIFSharedStringTuple (  )  const [virtual]

Return the attribute's shared string tuple interface or NULL.

Reimplemented in GA_ATIString.

virtual const GA_AIFStat* GA_Attribute::getAIFStat (  )  const [virtual]

Return the attribute's stat interface. Unlike other interfaces, this method has default behaviour.

Reimplemented in GA_ATIBlindData.

virtual const GA_AIFStringTuple* GA_Attribute::getAIFStringTuple (  )  const [virtual]

Return the attribute's string tuple interface or NULL.

Reimplemented in GA_ATIString.

Examples:
VRAY/VRAY_DemoSprite.C.

virtual const GA_AIFTuple* GA_Attribute::getAIFTuple (  )  const [virtual]

Return the attribute's tuple interface or NULL.

Reimplemented in GA_ATIGroupBool, GA_ATIIndexPair, and GA_ATINumeric.

Examples:
VRAY/VRAY_DemoSprite.C.

const GA_Detail& GA_Attribute::getDetail (  )  const

const char* GA_Attribute::getFullName (  )  const [inline]

Definition at line 106 of file GA_Attribute.h.

const GA_IndexMap& GA_Attribute::getIndexMap (  )  const [inline]

Definition at line 72 of file GA_Attribute.h.

virtual int64 GA_Attribute::getMemoryUsage (  )  const [pure virtual]

const char* GA_Attribute::getName ( void   )  const [inline]

Examples:
field3d/f3d_io.C, SOP/SOP_PrimVOP.C, and VRAY/VRAY_DemoSprite.C.

Definition at line 105 of file GA_Attribute.h.

UT_Options& GA_Attribute::getOptions (  )  [inline]

Definition at line 158 of file GA_Attribute.h.

const UT_Options& GA_Attribute::getOptions (  )  const [inline]

Definition at line 157 of file GA_Attribute.h.

GA_AttributeOwner GA_Attribute::getOwner (  )  const

GA_ConstAttributeProxyHandle GA_Attribute::getProxy (  )  const [inline]

Obtains the proxy representative used as a reference holder to this attribute. This proxy gets invalidated when the attribute gets deleted. Invalidation clears the proxy's pointer to NULL, but the proxy's memory stays valid, unlike the memory of the attribute object.

Definition at line 85 of file GA_Attribute.h.

GA_AttributeProxyHandle GA_Attribute::getProxy (  )  [inline]

Obtains the proxy representative used as a reference holder to this attribute. This proxy gets invalidated when the attribute gets deleted. Invalidation clears the proxy's pointer to NULL, but the proxy's memory stays valid, unlike the memory of the attribute object.

Definition at line 83 of file GA_Attribute.h.

virtual int GA_Attribute::getSaveVersion (  )  const [virtual]

Return the optional "save" version number. This is passed to the JSON attribute loader. If the version is <= 0, the version is not saved to the file and 0 will be passed to the loader.

GA_AttributeScope GA_Attribute::getScope (  )  const [inline]

Definition at line 76 of file GA_Attribute.h.

GA_StorageClass GA_Attribute::getStorageClass (  )  const

Returns the approximate type of the attribute.

Examples:
SOP/SOP_PrimVOP.C.

virtual WriteConcurrence GA_Attribute::getSupportedWriteConcurrence (  )  const [pure virtual]

int GA_Attribute::getTupleSize (  )  const

Size of the AIFTuple, if it exists. If it doesn't, 1.

Reimplemented in GA_ATIBlob, and GA_ATINumeric.

Examples:
SOP/SOP_PrimVOP.C.

const GA_AttributeType& GA_Attribute::getType ( void   )  const [inline]

Definition at line 71 of file GA_Attribute.h.

GA_TypeInfo GA_Attribute::getTypeInfo (  )  const

Uses the "type" option to determine type information

See also:
getOptions()

bool GA_Attribute::importOption ( const char *  name,
UT_String v 
) const [inline]

Definition at line 207 of file GA_Attribute.h.

bool GA_Attribute::importOption ( const char *  name,
fpreal64 v 
) const [inline]

Definition at line 205 of file GA_Attribute.h.

bool GA_Attribute::importOption ( const char *  name,
fpreal32 v 
) const [inline]

Definition at line 203 of file GA_Attribute.h.

bool GA_Attribute::importOption ( const char *  name,
bool &  v 
) const [inline]

Definition at line 201 of file GA_Attribute.h.

bool GA_Attribute::importOption ( const char *  name,
int &  v 
) const [inline]

Definition at line 199 of file GA_Attribute.h.

bool GA_Attribute::isNonTransforming (  )  const [inline]

Although an attribute may be a "point" or "normal", we may not want to transform the point. This is the case with "rest" for example. At the current time, this looks for "attribute:non_transforming" in the options.

See also:
getTypeInfo()

Definition at line 166 of file GA_Attribute.h.

bool GA_Attribute::isTailInitialization (  )  const [inline]

Check whether the attribute is set to tail initialization.

Definition at line 224 of file GA_Attribute.h.

static bool GA_Attribute::jsonLoadDefinition ( UT_JSONParser p,
GA_AttributeScope scope,
UT_WorkBuffer type,
UT_WorkBuffer name,
int64 version,
UT_Options options 
) [static]

Load the GA_Attribute-Definition section.

bool GA_Attribute::jsonSaveDefinition ( UT_JSONWriter w  )  const

Save the GA_Attribute-Definition section.

JSON Schema: GA_Attribute

The schema for an attribute consists of an array of two items. The first entry contains of the definition of the attribute. The second entry is the "private" data for the attribute. If there is no data for the attribute (i.e. the attribute doesn't provide an AIFJSON), then a null will be saved as the second element.

The private data is saved/loaded by the GA_AIFJSON class for the attribute.

 [
    "name"   : "GA_Attribute",
    "description" :
          "An attribute is defined by an array with two items.  The
           first item is the definition of the attribute, the second
           is private data associated with the attribute (may be null).",
    "type" : "array",
    "items" : [
        { "$ref" : "GA_Attribute-Definition" }, // Attribute Definition
        { "$ref" : "GA_Attribute-Data" },       // Specific type data
    ],
 ]

JSON Schema: GA_Attribute-Definition

The attribute definition is a map containing the fields required to recreate the attribute.
 {
     "name"          : "GA_Attribute-Definition",
     "description"   : "An map defining the attribute",
     "type"          : "orderedmap",
     "properties": {
         "scope": {
             "type"        : "string",
             "optional"    : true,
             "default"     : "public",
             "description" : "Scope of the attribute",
         },
         "type": {
             "type"          : "string",
             "description"   : "Attribute type (ATI name)",
         },
         "name": {
             "type"        : "string",
             "description" : "Name of the attribute",
         },
         "version": {
             "type"        : "integer",
             "optional"    : true,
             "description" : "Version level for save",
         },
         "options": {
             "type"  : { "$ref" : "UT_Options" }
             "description" : "Arbitrary options on the attribute",
         },
     },
 }
See also:
JSON_FileFormat, GA_AttributeSet, GA_AttributeType

void GA_Attribute::mergeOptions ( const UT_Options src  )  [inline]

Merge the options passed in with the options in the attribute.

Definition at line 195 of file GA_Attribute.h.

virtual bool GA_Attribute::needDestruction (  )  const [virtual]

Methods which can be overridden from GA_Attribute.

Element destruction event. When an element is destroyed, the attribute may be notified of this event.

Reimplemented in GA_ATIBlob, and GA_ATIGroupBool.

bool GA_Attribute::needsTransform ( bool  include_P = true  )  const [inline]

needTransform() checks whether the type info and transforming flags are set.

Definition at line 185 of file GA_Attribute.h.

virtual void GA_Attribute::reconstructElement ( GA_Offset  offset  )  [virtual]

When the array size is grown, attributes should initialize the value appropriately. When an element is reused, however, the reconstructElement is called. This happens if an element is deleted then a new element is allocated (using the existing slot)

Reimplemented in GA_ATIBlindData, GA_ATIGroupBool, GA_ATIIndexPair, and GA_ATINumeric.

bool GA_Attribute::setArraySize ( GA_Size  size  ) 

void GA_Attribute::setNonTransforming ( bool  val  )  [inline]

Although an attribute may be a "point" or "normal", we may not want to transform the point. This is the case with "rest" for example. At the current time, this looks for "attribute:non_transforming" in the options.

See also:
getTypeInfo()

Definition at line 176 of file GA_Attribute.h.

void GA_Attribute::setTailInitialization ( bool  onoff  ) 

The GA library expects any elements allocated at the end of the array to be set to their default values. If this is not the case, then the attribute can register itself for special initialization.

bool GA_Attribute::setTypeInfo ( GA_TypeInfo  type  ) 

Set the option. This sets the "type" option on the attribute

See also:
getOptions()


Friends And Related Function Documentation

friend class GA_AttributeSet [friend]

Only called by GA_AttributeSet

Definition at line 377 of file GA_Attribute.h.

GA_Attribute* GA_AttributeType::create ( const GA_IndexMap ,
GA_AttributeScope  ,
const char *  ,
const UT_Options ,
const UT_Options  
) const [friend]

friend class GA_MergeMap [friend]

Only called by GA_AttributeSet

Definition at line 378 of file GA_Attribute.h.


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

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