VR-Exchange 2.1 API Documentation
Macros
addAttribute.h File Reference

Contains the DtDEC_ATTRIBUTE macros. More...

Go to the source code of this file.

Macros

#define DtDEC_ATTRIBUTE(T, N, n)
 A Macro to define an attribute; as well as make an accessor and mutator for that attribute.
#define DtDEC_ATTRIBUTE_OVERLOAD(Type, Name, name, Attribute)
 A Macro to define an overload accessor and mutator for an existing attribute.

Detailed Description

Contains the DtDEC_ATTRIBUTE macros.

Macro Definition Documentation

#define DtDEC_ATTRIBUTE (   T,
  N,
 
)
Value:
public : \
void set##N(const T& val) { my##N = val;}\
const T& n() const { return my##N;} \
T& n() { return my##N;} \
protected: \
T my##N;

A Macro to define an attribute; as well as make an accessor and mutator for that attribute.

Note
All class members following this macro are set to protected.
Example
DtDEC_ATTRIBUTE( int, Index, index );

Is equivalent to:

Example
public:
void setIndex( const int& value )
{
myIndex = value;
}
const int& index() const
{
return myIndex;
}
int& index()
{
return myIndex;
}
protected:
int myIndex;
#define DtDEC_ATTRIBUTE_OVERLOAD (   Type,
  Name,
  name,
  Attribute 
)
Value:
public : \
void set##Name( const Type& value ) \
{ \
my##Attribute = value; \
} \
const Type& name() const \
{ \
return my##Attribute; \
} \
Type& name() \
{ \
return my##Attribute; \
} \
protected: \
enum{} /*enum{} is used so the macro and end with a simicolon. */

A Macro to define an overload accessor and mutator for an existing attribute.

Note
Do not use the overloaded attribute /e name for calculations of message encoding, decoding, or size.
All class members following this macro are set to protected.
Example
DtDEC_ATTRIBUTE_OVERLOAD( int, Element, element, Index );

Is equivalent to:

Example
public:
void setElement( const int& value )
{
myIndex = value;
}
const int& element() const
{
return myIndex;
}
int& element()
{
return myIndex;
}
protected:

Document ID: Generated on Tue Aug 7 22:07:13 EDT 2012 from SVN revision 117874
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)