DD::Image::Attribute Class Reference

General Attribute class. More...

Inherits DD::Image::RefCountedObject.

Public Member Functions

 Attribute (const Attribute &src)
 
 Attribute (const char *name, AttribType type, size_t size=0)
 
bool valid () const
 
bool invalid () const
 
Attributeoperator= (const Attribute &)
 
void copy (int dest, const Attribute &, int b_start)
 
void copy (int dest, const Attribute &, int b_start, int b_end)
 
bool append (const Attribute &, int b_start)
 
bool append (const Attribute &, int b_start, int b_end)
 
const char * name () const
 
AttribType type () const
 
unsigned size () const
 
unsigned capacity () const
 
void add (unsigned n=1)
 
void reserve (unsigned size)
 
void resize (size_t size)
 
void clear ()
 
void * array (unsigned n=0) const
 
size_t bytes () const
 
unsigned data_elements () const
 
unsigned floats () const
 
float & flt (const size_t n=0) const
 
Vector2vector2 (const size_t n=0) const
 
Vector3vector3 (const size_t n=0) const
 
Vector4vector4 (const size_t n=0) const
 
Vector3normal (const size_t n=0) const
 
Matrix3matrix3 (const size_t n=0) const
 
Matrix4matrix4 (const size_t n=0) const
 
int & integer (const size_t n=0) const
 
char *& string (const size_t n=0) const
 
std::string & stdstring (const size_t n=0) const
 
void *& pointer (const size_t n=0) const
 
void print_info () const
 
void print_value (const size_t n) const
 
- Public Member Functions inherited from DD::Image::RefCountedObject
void ref ()
 increment the reference count
 
void unref ()
 decrement the reference count. delete object if this becomes zero.
 
int refcount () const
 get the reference counter
 

Static Public Member Functions

static const char * type_string (int i)
 

Public Attributes

const char * name_
 Name of attribute.
 
AttribType type_
 Data type.
 
union {
   std::vector< float, STL3DAllocator< float > > *   float_list
 
   std::vector< Vector2, STL3DAllocator< Vector2 > > *   vector2_list
 
   std::vector< Vector3, STL3DAllocator< Vector3 > > *   vector3_list
 
   std::vector< Vector4, STL3DAllocator< Vector4 > > *   vector4_list
 
   std::vector< Matrix3, STL3DAllocator< Matrix3 > > *   matrix3_list
 
   std::vector< Matrix4, STL3DAllocator< Matrix4 > > *   matrix4_list
 
   std::vector< int, STL3DAllocator< int > > *   int_list
 
   std::vector< char *, STL3DAllocator< char * > > *   string_list
 
   std::vector< std::string, STL3DAllocator< std::string > > *   std_string_list
 
   std::vector< void *, STL3DAllocator< void * > > *   pointer_list
 
   void *   data
 
}; 
 

Static Public Attributes

static const char * attribute_types []
 

Friends

class GeoInfo
 
class GeoOp
 

Detailed Description

General Attribute class.

Constructor & Destructor Documentation

DD::Image::Attribute::Attribute ( const Attribute src)
inline

Copy constructor.

Member Function Documentation

void Attribute::copy ( int  dest,
const Attribute b,
int  b_start 
)

Destructively copy a single item from 'b_start' to 'dest'.

void Attribute::copy ( int  dest,
const Attribute b,
int  b_start,
int  b_end 
)
bool Attribute::append ( const Attribute b,
int  b_start 
)

Appends data elements from a same type Attribute onto the end of this one. Fails if both types are not the same.

bool Attribute::append ( const Attribute b,
int  b_start,
int  b_end 
)

Appends a range of elements from a same type Attribute onto the end of this one. Fails if both types are not the same.

References array(), size(), and type_.

void Attribute::add ( unsigned  n = 1)

Add 'n' elements to end of list.

Referenced by DD::Image::GeometryList::add_primitive().

void Attribute::reserve ( unsigned  size)

Reserve memory in list for 'n' elements. If you already know the maximum size of the attribute, this can save a lot of overhead if you call this before adding single elements.

References DD::Image::FLOAT_ATTRIB, DD::Image::INT_ATTRIB, DD::Image::INVALID_ATTRIB, DD::Image::MATRIX3_ATTRIB, DD::Image::MATRIX4_ATTRIB, DD::Image::NORMAL_ATTRIB, DD::Image::POINTER_ATTRIB, DD::Image::STD_STRING_ATTRIB, DD::Image::STRING_ATTRIB, DD::Image::VECTOR2_ATTRIB, DD::Image::VECTOR3_ATTRIB, and DD::Image::VECTOR4_ATTRIB.



©2021 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk