GB_Attribute Class Reference

Definition of a geometry attribute. More...

#include <GB_Attribute.h>

Inheritance diagram for GB_Attribute:

UT_LinkNode

List of all members.

Public Member Functions

 GB_Attribute (const char *n, int s, GB_AttribType t, const void *def)
 GB_Attribute (const char *n, int s, GB_AttribType t, GB_AttribTypeInfo f, const void *def)
 ~GB_Attribute ()
void initialize (const char *n, int s, GB_AttribType t, GB_AttribTypeInfo f, const void *def)
void setDefault (const void *def)
const char * getName () const
 Return the name of the attribute.
GB_AttribType getType () const
 Return the type of the attribute.
GB_AttribTypeInfo getTypeInfo () const
 Return the extended type information for the attribute.
const void * getDefault () const
 Return a pointer to the default data (may be NULL).
void rename (const char *newname)
void setType (GB_AttribType t)
 Set the type of the attribute.
void setTypeInfo (GB_AttribTypeInfo t)
 Set extended type information.
int addIndex (const char *label)
int addString (const char *label, bool check_dups=true)
void renameIndex (int idx, const char *label)
 Renames a string from one value to another.
int destroyIndex (const char *label)
int destroyIndex (int index)
void clearIndex (void)
void removeRedundantIndex (void)
 Remove duplicate entries in the index table.
int getIndexSize (void) const
 Return the number of strings in the index table.
int getIndex (const char *label) const
 Find the index of a given string. Returns -1 if no string is found.
const char * getIndex (int idx) const
 Return the string at the given index. This function may return NULL.
int getSize () const
int getAllocSize () const
int saveIndexValues (ostream &os, int binary) const
bool loadIndexValues (UT_IStream &is)
size_t addStrings (const UT_StringArray &strings, bool check_duplicates=true, int *string_ids=NULL)
size_t addStrings (const UT_StringList &strings, bool check_duplicates=true, int *string_ids=NULL)

Friends

class GB_AttributeDict


Detailed Description

Definition of a geometry attribute.
Examples:

SOP/SOP_BrushHairLen.C, SOP/SOP_DetailAttrib.C, SOP/SOP_PrimVOP.C, and VRAY/VRAY_DemoSprite.C.

Definition at line 59 of file GB_Attribute.h.


Constructor & Destructor Documentation

GB_Attribute::GB_Attribute ( const char *  n,
int  s,
GB_AttribType  t,
const void *  def 
)

GB_Attribute::GB_Attribute ( const char *  n,
int  s,
GB_AttribType  t,
GB_AttribTypeInfo  f,
const void *  def 
)

GB_Attribute::~GB_Attribute (  ) 


Member Function Documentation

int GB_Attribute::addIndex ( const char *  label  ) 

Add or return an existing index of a string.

See also:
GB_AttribType
Examples:
VRAY/VRAY_DemoSprite.C.

int GB_Attribute::addString ( const char *  label,
bool  check_dups = true 
)

Similar to addIndex(), this method adds a string to the shared string table, returning the index of the string. You should only set the check_dups flag to false if you are positive the label doesn't already exist in the string table (or will be calling removeRedundantIndex() after the fact.

size_t GB_Attribute::addStrings ( const UT_StringList strings,
bool  check_duplicates = true,
int *  string_ids = NULL 
)

Add multiple strings to the string table. You should only set the check_dups flag to false if you are positive that there are no duplicates in the string list and there are no duplicate entries in the list itself. If an integer array is passed in, the indices associated with each string will be set. The method returns the number of strings added.

size_t GB_Attribute::addStrings ( const UT_StringArray strings,
bool  check_duplicates = true,
int *  string_ids = NULL 
)

Add multiple strings to the string table. You should only set the check_dups flag to false if you are positive that there are no duplicates in the string list and there are no duplicate entries in the list itself. If an integer array is passed in, the indices associated with each string will be set. The method returns the number of strings added.

void GB_Attribute::clearIndex ( void   ) 

Remove all strings from the index table. Attribute values will not be adjusted automatically.

int GB_Attribute::destroyIndex ( int  index  ) 

Removes the string with the given index. This may adjust the index values of other strings. The attribute values will not be adjusted automatically.

int GB_Attribute::destroyIndex ( const char *  label  )  [inline]

Removes a string from the index table. This may adjust the index values of other strings. The attribute values will not be adjusted automatically.

Definition at line 138 of file GB_Attribute.h.

int GB_Attribute::getAllocSize (  )  const [inline]

Return the size (in bytes) of the attribute

Warning:
The size of the attribute is the size in bytes that the attribute data requires.
Note:
Due to memory alignment issues on some processors, the allocated size may be larger than the size required. Please be aware of this.

Definition at line 81 of file GB_Attribute.h.

const void* GB_Attribute::getDefault (  )  const [inline]

Return a pointer to the default data (may be NULL).

Examples:
SOP/SOP_TimeCompare.C.

Definition at line 90 of file GB_Attribute.h.

const char* GB_Attribute::getIndex ( int  idx  )  const [inline]

Return the string at the given index. This function may return NULL.

Definition at line 157 of file GB_Attribute.h.

int GB_Attribute::getIndex ( const char *  label  )  const

Find the index of a given string. Returns -1 if no string is found.

Examples:
VRAY/VRAY_DemoSprite.C.

int GB_Attribute::getIndexSize ( void   )  const [inline]

Return the number of strings in the index table.

Examples:
VRAY/VRAY_DemoSprite.C.

Definition at line 152 of file GB_Attribute.h.

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

Return the name of the attribute.

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

Definition at line 72 of file GB_Attribute.h.

int GB_Attribute::getSize (  )  const [inline]

Return the size (in bytes) of the attribute

Warning:
The size of the attribute is the size in bytes that the attribute data requires.
Note:
Due to memory alignment issues on some processors, the allocated size may be larger than the size required. Please be aware of this.
Examples:
SOP/SOP_DetailAttrib.C, SOP/SOP_PrimVOP.C, SOP/SOP_TimeCompare.C, and VRAY/VRAY_DemoSprite.C.

Definition at line 80 of file GB_Attribute.h.

GB_AttribType GB_Attribute::getType ( void   )  const [inline]

Return the type of the attribute.

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

Definition at line 86 of file GB_Attribute.h.

GB_AttribTypeInfo GB_Attribute::getTypeInfo (  )  const [inline]

Return the extended type information for the attribute.

Examples:
SOP/SOP_TimeCompare.C.

Definition at line 88 of file GB_Attribute.h.

void GB_Attribute::initialize ( const char *  n,
int  s,
GB_AttribType  t,
GB_AttribTypeInfo  f,
const void *  def 
)

bool GB_Attribute::loadIndexValues ( UT_IStream is  ) 

Save/load string index table values

void GB_Attribute::removeRedundantIndex ( void   ) 

Remove duplicate entries in the index table.

void GB_Attribute::rename ( const char *  newname  ) 

Change the name of the attribute

Warning:
This does not check for duplicate names

void GB_Attribute::renameIndex ( int  idx,
const char *  label 
)

Renames a string from one value to another.

int GB_Attribute::saveIndexValues ( ostream &  os,
int  binary 
) const

Save/load string index table values

void GB_Attribute::setDefault ( const void *  def  ) 

void GB_Attribute::setType ( GB_AttribType  t  )  [inline]

Set the type of the attribute.

Definition at line 97 of file GB_Attribute.h.

void GB_Attribute::setTypeInfo ( GB_AttribTypeInfo  t  )  [inline]

Set extended type information.

Definition at line 99 of file GB_Attribute.h.


Friends And Related Function Documentation

friend class GB_AttributeDict [friend]

Definition at line 180 of file GB_Attribute.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