vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vrecko::DynamicAttribute Class Reference

#include <DynamicAttribute.h>

Inheritance diagram for vrecko::DynamicAttribute:
vrecko::Attribute

Public Member Functions

 DynamicAttribute (const string &strName, const string &strDescription, unsigned int minInstancesCount=0, unsigned int maxInstancesCount=10)
 
 ~DynamicAttribute ()
 
unsigned int getMinInstancesCount () const
 
unsigned int getMaxInstancesCount () const
 
bool addAttribute (Attribute *pAttribute)
 
unsigned int attributesCount () const
 
bool containsAttribute (const string &strName) const
 
const AttributegetAttributePtr (const string &strName) const
 
void startIteration ()
 
bool hasNextAttribute () const
 
const AttributenextAttributePtr ()
 
- Public Member Functions inherited from vrecko::Attribute
const string & getName () const
 
DataType getDataType () const
 
const string & getDescription () const
 
bool isStatic () const
 
bool isDynamic () const
 

Additional Inherited Members

- Public Types inherited from vrecko::Attribute
enum  DataType {
  TYPE_BOOL, TYPE_INT, TYPE_LONG, TYPE_FLOAT,
  TYPE_DOUBLE, TYPE_STRING, TYPE_VEC2, TYPE_VEC3,
  TYPE_VEC4, TYPE_MATRIX, TYPE_QUAT, TYPE_DYNAMIC
}
 
- Protected Member Functions inherited from vrecko::Attribute
 Attribute (const string &strName, DataType dataType, const string &strDescription)
 
 Attribute (const Attribute &attribute)
 

Detailed Description

Represents a dynamic attribute which can be composed of one or more static attributes.

This class serves as a container for objects of Attribute class. Therefore it can be used as a node in the attributes hierarchy. You can insert only static attributes now. More complex tree structure of the attributes hierarchy might be available later on.

See Also
Attribute
StaticAttribute

Constructor & Destructor Documentation

vrecko::DynamicAttribute::DynamicAttribute ( const string &  strName,
const string &  strDescription,
unsigned int  minInstancesCount = 0,
unsigned int  maxInstancesCount = 10 
)
inline

Constructs a DynamicAttribute object.

Parameters
strNamereference to a constant attribute name
strDescriptionreference to a constant attribute description
minInstancesCountnumber of min instances
maxInstancesCountnumber of max instances
vrecko::DynamicAttribute::~DynamicAttribute ( )
inline

Performs cleanup before object destruction.

Member Function Documentation

bool vrecko::DynamicAttribute::addAttribute ( Attribute pAttribute)
inline

Adds a static attribute if not already included.

Any pointers passed to this method as parameters are used directly, no copy is made. You have to ensure a unique pointer is passed per each call of this method. Also ensure that the pointer is used only wihtin the context of this method and nowhere else and stays valid all the time. Allocated memory is freed automatically.

Parameters
pAttributepointer to an Attribute object on the heap
Returns
true if the attribute has been added, false otherwise
unsigned int vrecko::DynamicAttribute::attributesCount ( ) const
inline

Returns attributes count.

Returns
number of attributes present
bool vrecko::DynamicAttribute::containsAttribute ( const string &  strName) const
inline

"Contains attribute" predicate.

Parameters
strNamereference to a constant attribute name used as a key for searching
Returns
true if an attribute with given name is contained, false otherwise
const Attribute* vrecko::DynamicAttribute::getAttributePtr ( const string &  strName) const
inline

Returns pointer to an attribute based on its name.

Parameters
strNamereference to a constant attribute name used as a key for searching
Returns
pointer to a constant Attribute object
unsigned int vrecko::DynamicAttribute::getMaxInstancesCount ( ) const
inline

Returns number of max attribute instances.

Returns
number of max instances of this attribute that can be created
unsigned int vrecko::DynamicAttribute::getMinInstancesCount ( ) const
inline

Returns number of min attribute instances.

Returns
number of min instances of this attribute that should be created
bool vrecko::DynamicAttribute::hasNextAttribute ( ) const
inline

"Has next attribute" predicate.

You have to initialize the internal interator first by calling startIteration() before you call this method!

Returns
true if there is a next attribute in the object
See Also
startIteration()
nextAttributePtr()
const Attribute* vrecko::DynamicAttribute::nextAttributePtr ( )
inline

Returns pointer to current attribute and increments the iterator.

You have to initialize the internal interator first by calling startIteration() before you call this method!

Returns
pointer to a constant Attribute object pointed to by the internal iterator
See Also
startIteration()
hasNextAttribute()
void vrecko::DynamicAttribute::startIteration ( )
inline

Initializes the internal iterator.


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