DynData Class Reference
[DynI derived classes]

#include <DoBase.hpp>

Inheritance diagram for DynData:

DynI VObj

List of all members.

Public Member Functions

DynObjType *docall doGetType (const DynI **pself) const
Main interface


template<class T>
 DynData (T t)
int GetType ()
template<class T>
bool IsA () const
template<class T>
Get () const

Protected Attributes

int m_type
union {
   char   m_data [DYNDATA_MAX_SIZE]
   const char *   m_str
}; 


Detailed Description

Store/retrieve any datatype at run-time. Dynamically typed data holder. Stores data any (most) run-time data together with its type. The most important use is together with DynObj constructors.

Constructor & Destructor Documentation

template<class T>
DynData::DynData ( t  )  [inline]

Constructor, takes arbitrary type.


Member Function Documentation

DynObjType* docall DynData::doGetType ( const DynI **  pself  )  const [virtual]

Returns type of this object. Each type that wants to make itself known should override this method. DynI knows its own type so we get the type without any lookup. It is faster and works without registration.

Parameters:
pself allows fetching the actual 'this' used inside doGetType (from a side base, this will be different to the 'this' of the caller).
Returns:
A DynObjType pointer

Reimplemented from DynI.

int DynData::GetType (  )  [inline]

Returns current type id.

Returns:
full type ID including pointer level, const and ref

template<class T>
bool DynData::IsA (  )  const [inline]

Check if the DynData can return requested type without loosing precision. This mainly follows C++ casting rules.

Returns:
true if type can be cast to, false otherwise.

template<class T>
T DynData::Get (  )  const [inline]

Cast to requested type. This can be applied after checking the IsA function above. If type is not supported a run-time assert happens.

Returns:
The internal value casted to requested type without any loss of precision.


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

Generated on Sun Feb 15 16:35:57 2009 for DynObj by  doxygen 1.5.6