DigitalSpaces::Variant Class Reference
[Implementations]

#include <ContainerImplementations.h>

Inherits DigitalSpaces::DIVariant.


Detailed Description

Class to pass the Variant_Impl structure across component boundaries (as a DInterface).

Provides:


Public Member Functions

 Variant ()
 Default constructor. Object is initialized as empty.
 Variant (const Variant &rhs)
 Copy Constructor.
 Variant (const Variant_Impl &rhs)
 Copy Constructor.
Variantoperator= (const Variant &rhs)
 Assignment operator.
 Variant (DIVariant *rhs)
 Constructor that extracts the value from a DIVariant.
template<typename T>
 Variant (const T &rhs)
 Constructor that accepts any of the wrappable data types.
Inspection routines
bool isEmpty ()
 Checks if the container never been assigned a value.
bool isDIPtr ()
bool isBool ()
bool isInt ()
bool isUInt ()
bool isDouble ()
bool isString ()
bool isVector ()
bool isQuaternion ()
bool isColour ()
bool isSettingMap ()
Extraction routines
DIObjectBasegetDIPtr ()
 Returns an object interface, or NULL if not a DIPtr.
bool getBool ()
 Returns the boolean value, or false if not a boolean.
signed int getInt ()
 Returns the integer value, or 0 if not an integer.
unsigned int getUInt ()
 Returns the unsigned integer value, or 0 if not an unsigned integer.
double getDouble ()
 Returns the double precision floating point value, or 0.0 if not a double precision floating point value.
const char * getString ()
 Returns the value of the string, or attempts a conversion from the object type to a string, and returns a pointer to the resulting string.
void getVector (out_Vector3f *)
 Returns the vector value, or 0,0,0 if not a vector.
void getQuaternion (out_Quaternionf *)
 Returns the quaternion value, or 1,0,0,0 (IDENTITY) if not a quaternion.
void getColour (out_Vector4f *)
 Returns the colour value, or 0,0,0,0 if not a vector.
DISettingMapgetSettingMap ()
 Returns an interface to the contained SettingMap, or NULL if not a SettingMap.
Assignment
void setDIPtr (DIObjectBase *value)
 Assign an object interface to the object.
void setBool (bool value)
 Assign a boolean value to the object.
void setInt (signed int value)
 Assign an integer value to the object.
void setUInt (unsigned int value)
 Assign an unsigned integer value to the object.
void setDouble (double value)
 Assign a double precision floating point value to the object.
void setString (const char *value)
 Assign a string to the object.
void setVector (in_Vector3f *value)
 Assign a vector value to the object.
void setQuaternion (in_Quaternionf *value)
 Assign a quaternion value to the object.
void setColour (in_Vector4f *value)
 Assign a colour value to the object.
void setSettingMap (DISettingMap *value)
 Assign a SettingMap to the object.

Private Attributes

Variant_Impl _value
 The actual value being abstracted.
std::string _value_str
 Storage used in getStringVisitor when dealing with non-strings.

Data Structures

struct  getGenericVisitor
 Generic visitor that returns the value if its the right type, otherwise returns a provided "bad" (or default) value. More...
struct  getStringVisitor
 An anything-to-string converter, for getString. More...
struct  isTypeVisitor
 Visitor that returns true if the data is the type specified, and false if not. More...

Constructor & Destructor Documentation

DigitalSpaces::Variant::Variant (  )  [inline]

Default constructor. Object is initialized as empty.

DigitalSpaces::Variant::Variant ( const Variant rhs  )  [inline]

Copy Constructor.

DigitalSpaces::Variant::Variant ( const Variant_Impl rhs  )  [inline]

Copy Constructor.

DigitalSpaces::Variant::Variant ( DIVariant rhs  )  [inline]

Constructor that extracts the value from a DIVariant.

Todo:
Need a constructor from a DIVariant that doesn't do a dubious typecast

template<typename T>
DigitalSpaces::Variant::Variant ( const T &  rhs  )  [inline]

Constructor that accepts any of the wrappable data types.


Member Function Documentation

Variant& DigitalSpaces::Variant::operator= ( const Variant rhs  )  [inline]

Assignment operator.

bool DigitalSpaces::Variant::isEmpty (  ) 

Checks if the container never been assigned a value.

The only way for this to return true is for none of the Assignment functions to have ever been called.

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isDIPtr (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isBool (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isInt (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isUInt (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isDouble (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isString (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isVector (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isQuaternion (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isColour (  ) 

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::isSettingMap (  ) 

Reimplemented from DigitalSpaces::DIVariant.

DIObjectBase* DigitalSpaces::Variant::getDIPtr (  ) 

Returns an object interface, or NULL if not a DIPtr.

Reimplemented from DigitalSpaces::DIVariant.

bool DigitalSpaces::Variant::getBool (  ) 

Returns the boolean value, or false if not a boolean.

Note that the "error" return is also a legitimate return value.

Reimplemented from DigitalSpaces::DIVariant.

signed int DigitalSpaces::Variant::getInt (  ) 

Returns the integer value, or 0 if not an integer.

Note that the "error" return is also a legitimate return value.

Reimplemented from DigitalSpaces::DIVariant.

unsigned int DigitalSpaces::Variant::getUInt (  ) 

Returns the unsigned integer value, or 0 if not an unsigned integer.

Note that the "error" return is also a legitimate return value.

Reimplemented from DigitalSpaces::DIVariant.

double DigitalSpaces::Variant::getDouble (  ) 

Returns the double precision floating point value, or 0.0 if not a double precision floating point value.

Note that the "error" return is also a legitimate return value.

Reimplemented from DigitalSpaces::DIVariant.

const char* DigitalSpaces::Variant::getString (  ) 

Returns the value of the string, or attempts a conversion from the object type to a string, and returns a pointer to the resulting string.

Note that the conversion result is stored in a temporary variable, and will not remain valid after another call to this function.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::getVector ( out_Vector3f value  ) 

Returns the vector value, or 0,0,0 if not a vector.

Note that the "error" return is also a legitimate return value.

Parameters:
value Adress of a out_Vector3f structure to be filled in with the contained value.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::getQuaternion ( out_Quaternionf  ) 

Returns the quaternion value, or 1,0,0,0 (IDENTITY) if not a quaternion.

Note that the "error" return is also a legitimate return value.

Parameters:
value Adress of a out_Quaternionf structure to be filled in with the contained value.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::getColour ( out_Vector4f  ) 

Returns the colour value, or 0,0,0,0 if not a vector.

Note that the "error" return is also a legitimate return value.

Parameters:
value Adress of a out_Vector4f structure to be filled in with the contained value.

Reimplemented from DigitalSpaces::DIVariant.

DISettingMap* DigitalSpaces::Variant::getSettingMap (  ) 

Returns an interface to the contained SettingMap, or NULL if not a SettingMap.

Note that this is an interface to the stored SettingMap, and altering it will alter the stored value.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setDIPtr ( DIObjectBase value  ) 

Assign an object interface to the object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setBool ( bool  value  ) 

Assign a boolean value to the object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setInt ( signed int  value  ) 

Assign an integer value to the object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setUInt ( unsigned int  value  ) 

Assign an unsigned integer value to the object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setDouble ( double  value  ) 

Assign a double precision floating point value to the object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setString ( const char *  value  ) 

Assign a string to the object.

Note that the string is copied for storage, and altering the original string will not affect this object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setVector ( in_Vector3f value  ) 

Assign a vector value to the object.

Note that the vector is copied for storage, and altering the original vector will not affect this object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setQuaternion ( in_Quaternionf value  ) 

Assign a quaternion value to the object.

Note that the quaternion is copied for storage, and altering the original quaternion will not affect this object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setColour ( in_Vector4f value  ) 

Assign a colour value to the object.

Note that the colour is copied for storage, and altering the original colour will not affect this object.

Reimplemented from DigitalSpaces::DIVariant.

void DigitalSpaces::Variant::setSettingMap ( DISettingMap value  ) 

Assign a SettingMap to the object.

Note that the object makes a duplicate of the SettingMap specified by value, and altering the origin SettingMap will not affect the SettingMap stored here.

Reimplemented from DigitalSpaces::DIVariant.


Field Documentation

The actual value being abstracted.

Referenced by operator=().

std::string DigitalSpaces::Variant::_value_str [private]

Storage used in getStringVisitor when dealing with non-strings.


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

Generated on Sun Aug 31 17:46:32 2008 for Digital Spaces by  doxygen 1.5.6