GB_AttributeHandle Class Reference

#include <GB_AttributeHandle.h>

Inheritance diagram for GB_AttributeHandle:

GB_AttributeHandleBase GEO_AttributeHandle

List of all members.

Public Member Functions

 GB_AttributeHandle ()
 Creates an empty attribute handle.
 GB_AttributeHandle (const GB_AttributeHandle &gah)
 GB_AttributeHandle (const GB_Detail *gdp, const GB_AttributeDict *dict, GB_Attribute *attrib, int size_in_bytes, GB_AttribType type)
 Creates a valid attribute handle.
virtual ~GB_AttributeHandle ()
virtual GB_AttributeHandleclone () const =0
virtual const char * getName () const
virtual void setRawElement (GB_AttributeElem *element)=0
virtual void setRawElement (const GB_AttributeElem *element)=0
int entries () const
 Returns the number of entries in this attribute.
virtual GB_AttributeHandleoperator= (const GB_AttributeHandle &gah)
void setF (fpreal val, int index=0)
 Generic Data Accessors.
fpreal getF (int index=0) const
void setI (int val, int index=0)
int getI (int index=0) const
void setV2 (const UT_Vector2 &val, int index=0)
UT_Vector2 getV2 (int index=0) const
void setV3 (const UT_Vector3 &val, int index=0)
UT_Vector3 getV3 (int index=0) const
void setV4 (const UT_Vector4 &val, int index=0)
UT_Vector4 getV4 (int index=0) const
void setM3 (const UT_Matrix3 &val, int index=0)
UT_Matrix3 getM3 (int index=0) const
void setM4 (const UT_Matrix4 &val, int index=0)
UT_Matrix4 getM4 (int index=0) const
template<typename T >
bool import (T &result) const
void setP4 (const UT_Vector4 &val, int index=0)
 p4 will return a 4th component of 1 if it does not exist
UT_Vector4 getP4 (int index=0) const
void setQ (const UT_Quaternion &val, int index=0)
 Fetch & set quaternion values.
UT_Quaternion getQ (int index=0) const
template<typename T >
T * getPointer (int index=0)
template<typename T >
const T * getPointer (int index=0) const
bool setString (const UT_String &str, int index=0)
bool getString (UT_String &str, int index=0, bool harden=true) const
void multiply (fpreal val)
 Unary arithmetic operations.
void setValue (fpreal val)
void transform (const UT_Matrix4 &xform, const UT_Matrix4 &inverse, bool keeplengths=false)
void addScale (const GB_AttributeHandle &gah, fpreal w)
 Performs: this = this + gah * w.
void multiply (const GB_AttributeHandle &gah)
 Performs: this = this * gah.
void divide (const GB_AttributeHandle &gah)
 Performs: this = this / gah.
void lerp (const GB_AttributeHandle &gah, fpreal w)
 Performs the operation this = this*(1-w) + gah*w.
void copyDataFrom (const GB_AttributeHandle &src)
 Copies the data from the src attribute to this attribute.
bool equalData (const GB_AttributeHandle &src, fpreal64 tol)
void resetData ()
virtual bool isAttributeValid () const =0
virtual bool isSourceAttributeValid () const =0
bool isFloatOrVectorAttribute () const
bool isIndexAttribute () const
bool getDefinedStrings (UT_StringArray &list, bool harden=true) const
int getNumDefinedStrings () const
const char * getDefinedString (int idx) const
 Returns the idxth defined string. Returns "" if invalid.
int addDefinedString (const char *name)
virtual void invalidate ()
 Invalidates the handle (gets rid of references to elements and details).
const GB_AttributegetAttribute () const
GB_AttributegetAttribute ()

Protected Member Functions

bool isValid () const
bool isSourceValid () const

Protected Attributes

GB_GenericData myData

Friends

class GB_AttributeListHandle
class GEO_AttributeHandleList


Detailed Description

Definition at line 40 of file GB_AttributeHandle.h.


Constructor & Destructor Documentation

GB_AttributeHandle::GB_AttributeHandle (  ) 

Creates an empty attribute handle.

GB_AttributeHandle::GB_AttributeHandle ( const GB_AttributeHandle gah  ) 

The copy constructor does not copy references to the element, only to the detail and the attribute offset.

GB_AttributeHandle::GB_AttributeHandle ( const GB_Detail gdp,
const GB_AttributeDict dict,
GB_Attribute attrib,
int  size_in_bytes,
GB_AttribType  type 
)

Creates a valid attribute handle.

virtual GB_AttributeHandle::~GB_AttributeHandle (  )  [virtual]


Member Function Documentation

int GB_AttributeHandle::addDefinedString ( const char *  name  ) 

Adds a string to our string table returning the index of the resulting string. If string already is in our table, returns the existing string. Empty ("") and null strings cannot be added to the table as they are implicitly -1.

void GB_AttributeHandle::addScale ( const GB_AttributeHandle gah,
fpreal  w 
) [inline]

Performs: this = this + gah * w.

Definition at line 152 of file GB_AttributeHandle.h.

virtual GB_AttributeHandle* GB_AttributeHandle::clone (  )  const [pure virtual]

Implemented in GEO_AttributeHandle.

void GB_AttributeHandle::copyDataFrom ( const GB_AttributeHandle src  )  [inline]

Copies the data from the src attribute to this attribute.

Definition at line 167 of file GB_AttributeHandle.h.

void GB_AttributeHandle::divide ( const GB_AttributeHandle gah  )  [inline]

Performs: this = this / gah.

Definition at line 159 of file GB_AttributeHandle.h.

int GB_AttributeHandle::entries (  )  const [inline]

Returns the number of entries in this attribute.

Examples:
SOP/SOP_TimeCompare.C.

Definition at line 69 of file GB_AttributeHandle.h.

bool GB_AttributeHandle::equalData ( const GB_AttributeHandle src,
fpreal64  tol 
) [inline]

Returns true if the data in src matches the data in this, and returns false otherwise.

Definition at line 172 of file GB_AttributeHandle.h.

GB_Attribute* GB_AttributeHandle::getAttribute (  )  [inline]

Accessor to underlying attribute

Definition at line 219 of file GB_AttributeHandle.h.

const GB_Attribute* GB_AttributeHandle::getAttribute (  )  const [inline]

Accessor to underlying attribute

Examples:
SOP/SOP_TimeCompare.C.

Definition at line 218 of file GB_AttributeHandle.h.

const char* GB_AttributeHandle::getDefinedString ( int  idx  )  const

Returns the idxth defined string. Returns "" if invalid.

bool GB_AttributeHandle::getDefinedStrings ( UT_StringArray list,
bool  harden = true 
) const

Returns true if the attribute handle has strings defined. It's possible that the array contains 0 strings.

fpreal GB_AttributeHandle::getF ( int  index = 0  )  const [inline]

Examples:
SOP/SOP_PrimVOP.C, and SOP/SOP_TimeCompare.C.

Definition at line 78 of file GB_AttributeHandle.h.

int GB_AttributeHandle::getI ( int  index = 0  )  const [inline]

Examples:
SOP/SOP_PrimVOP.C.

Definition at line 83 of file GB_AttributeHandle.h.

UT_Matrix3 GB_AttributeHandle::getM3 ( int  index = 0  )  const [inline]

Definition at line 103 of file GB_AttributeHandle.h.

UT_Matrix4 GB_AttributeHandle::getM4 ( int  index = 0  )  const [inline]

Definition at line 108 of file GB_AttributeHandle.h.

virtual const char* GB_AttributeHandle::getName (  )  const [virtual]

Reimplemented in GEO_AttributeHandle.

int GB_AttributeHandle::getNumDefinedStrings (  )  const

Returns the number of defined strings. Will return 0 if not a string table or no defined strings.

UT_Vector4 GB_AttributeHandle::getP4 ( int  index = 0  )  const [inline]

Definition at line 117 of file GB_AttributeHandle.h.

template<typename T >
const T* GB_AttributeHandle::getPointer ( int  index = 0  )  const [inline]

Definition at line 130 of file GB_AttributeHandle.h.

template<typename T >
T* GB_AttributeHandle::getPointer ( int  index = 0  )  [inline]

Definition at line 127 of file GB_AttributeHandle.h.

UT_Quaternion GB_AttributeHandle::getQ ( int  index = 0  )  const [inline]

Definition at line 123 of file GB_AttributeHandle.h.

bool GB_AttributeHandle::getString ( UT_String str,
int  index = 0,
bool  harden = true 
) const [inline]

Examples:
standalone/geo2voxel.C.

Definition at line 137 of file GB_AttributeHandle.h.

UT_Vector2 GB_AttributeHandle::getV2 ( int  index = 0  )  const [inline]

Definition at line 88 of file GB_AttributeHandle.h.

UT_Vector3 GB_AttributeHandle::getV3 ( int  index = 0  )  const [inline]

Examples:
POP/POP_CircleForce.C, and SOP/SOP_PrimVOP.C.

Definition at line 93 of file GB_AttributeHandle.h.

UT_Vector4 GB_AttributeHandle::getV4 ( int  index = 0  )  const [inline]

Examples:
SOP/SOP_CPPWave.C, and SOP/SOP_PrimVOP.C.

Definition at line 98 of file GB_AttributeHandle.h.

template<typename T >
bool GB_AttributeHandle::import ( T &  result  )  const [inline]

Definition at line 111 of file GB_AttributeHandle.h.

virtual void GB_AttributeHandle::invalidate (  )  [virtual]

Invalidates the handle (gets rid of references to elements and details).

Reimplemented from GB_AttributeHandleBase.

Reimplemented in GEO_AttributeHandle.

virtual bool GB_AttributeHandle::isAttributeValid (  )  const [pure virtual]

Returns true if our attribute handle is bound to a valid attribute and false otherwise.

Implemented in GEO_AttributeHandle.

bool GB_AttributeHandle::isFloatOrVectorAttribute (  )  const

Returns true if our attribute handle is bound to a valid attribute of type GB_ATTRIB_FLOAT or GB_ATTRIB_VECTOR.

bool GB_AttributeHandle::isIndexAttribute (  )  const

Returns true if our attribute handle is bound to a valid attribute of type GB_ATTRIB_INDEX

virtual bool GB_AttributeHandle::isSourceAttributeValid (  )  const [pure virtual]

Implemented in GEO_AttributeHandle.

bool GB_AttributeHandle::isSourceValid (  )  const [protected]

bool GB_AttributeHandle::isValid (  )  const [protected]

Returns true if our attribute handle is valid and false otherwise (i.e. bound to both attribute and an element)

void GB_AttributeHandle::lerp ( const GB_AttributeHandle gah,
fpreal  w 
) [inline]

Performs the operation this = this*(1-w) + gah*w.

Definition at line 163 of file GB_AttributeHandle.h.

void GB_AttributeHandle::multiply ( const GB_AttributeHandle gah  )  [inline]

Performs: this = this * gah.

Definition at line 156 of file GB_AttributeHandle.h.

void GB_AttributeHandle::multiply ( fpreal  val  )  [inline]

Unary arithmetic operations.

Reimplemented in GEO_AttributeHandle.

Definition at line 142 of file GB_AttributeHandle.h.

virtual GB_AttributeHandle& GB_AttributeHandle::operator= ( const GB_AttributeHandle gah  )  [virtual]

The operator= does not copy references to the element, only to the detail and the attribute offset.

void GB_AttributeHandle::resetData (  )  [inline]

Resets the value of the data to 'uninitialized'. For most types of attributes, this is zero, for others it is -1.

Definition at line 178 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setF ( fpreal  val,
int  index = 0 
) [inline]

Generic Data Accessors.

Examples:
SOP/SOP_PrimVOP.C, and SOP/SOP_TimeCompare.C.

Definition at line 76 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setI ( int  val,
int  index = 0 
) [inline]

Examples:
SOP/SOP_PrimVOP.C.

Definition at line 81 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setM3 ( const UT_Matrix3 val,
int  index = 0 
) [inline]

Definition at line 101 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setM4 ( const UT_Matrix4 val,
int  index = 0 
) [inline]

Definition at line 106 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setP4 ( const UT_Vector4 val,
int  index = 0 
) [inline]

p4 will return a 4th component of 1 if it does not exist

Definition at line 115 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setQ ( const UT_Quaternion val,
int  index = 0 
) [inline]

Fetch & set quaternion values.

Definition at line 121 of file GB_AttributeHandle.h.

virtual void GB_AttributeHandle::setRawElement ( const GB_AttributeElem element  )  [pure virtual]

Implemented in GEO_AttributeHandle.

virtual void GB_AttributeHandle::setRawElement ( GB_AttributeElem element  )  [pure virtual]

Sets the element on which this attribute handle will operate The const version will set a flag and prevent you from writing data to this element.

Implemented in GEO_AttributeHandle.

bool GB_AttributeHandle::setString ( const UT_String str,
int  index = 0 
) [inline]

Examples:
standalone/geo2voxel.C.

Definition at line 135 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setV2 ( const UT_Vector2 val,
int  index = 0 
) [inline]

Definition at line 86 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setV3 ( const UT_Vector3 val,
int  index = 0 
) [inline]

void GB_AttributeHandle::setV4 ( const UT_Vector4 val,
int  index = 0 
) [inline]

Examples:
SOP/SOP_CPPWave.C, and SOP/SOP_PrimVOP.C.

Definition at line 96 of file GB_AttributeHandle.h.

void GB_AttributeHandle::setValue ( fpreal  val  )  [inline]

Definition at line 143 of file GB_AttributeHandle.h.

void GB_AttributeHandle::transform ( const UT_Matrix4 xform,
const UT_Matrix4 inverse,
bool  keeplengths = false 
) [inline]

Definition at line 144 of file GB_AttributeHandle.h.


Friends And Related Function Documentation

friend class GB_AttributeListHandle [friend]

Definition at line 228 of file GB_AttributeHandle.h.

friend class GEO_AttributeHandleList [friend]

Definition at line 229 of file GB_AttributeHandle.h.


Member Data Documentation

Definition at line 232 of file GB_AttributeHandle.h.


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

Generated on Mon Jan 28 00:48:13 2013 for HDK by  doxygen 1.5.9