ValueWrapperInterface< T > Class Template Reference

#include <componentInterface.h>

Inheritance diagram for ValueWrapperInterface< T >:

Inheritance graph
[legend]
List of all members.

Detailed Description


template<class T> class ValueWrapperInterface< T >

This class is designed to wrap an existing class or type easily to allow a SimComponent to expose a property with custom processing code in an efficient and safe way.

Specialized templates could be written which include validation on sets, and processing on gets.


Public Member Functions

virtual bool isValid () const
 This will return true if the interface is valid.
const T & operator * ()
 Dereferencing a value interface will allow get to do any processing and return the reference to that.
const T & operator= (const T &lval)
 Assignment operator will invoke set.
 ValueWrapperInterface ()
 Default Constructor.
 ValueWrapperInterface (const T &copy)
 Copy constructor.
virtual ~ValueWrapperInterface ()
 Destructor, destroy memory.
virtual const T & get ()
 Get the value associated with this interface.
virtual const T & set (const T &t)
 Set the value associated with this interface.

Protected Attributes

T * mValuePtr

Private Types

typedef ComponentInterface Parent


Member Typedef Documentation

template<class T>
typedef ComponentInterface ValueWrapperInterface< T >::Parent [private]


Constructor & Destructor Documentation

template<class T>
ValueWrapperInterface< T >::ValueWrapperInterface (  )  [inline]

Default Constructor.

template<class T>
ValueWrapperInterface< T >::ValueWrapperInterface ( const T &  copy  )  [inline]

Copy constructor.

template<class T>
virtual ValueWrapperInterface< T >::~ValueWrapperInterface (  )  [inline, virtual]

Destructor, destroy memory.


Member Function Documentation

template<class T>
virtual bool ValueWrapperInterface< T >::isValid (  )  const [inline, virtual]

This will return true if the interface is valid.

Reimplemented from ComponentInterface.

template<class T>
const T& ValueWrapperInterface< T >::operator * (  )  [inline]

Dereferencing a value interface will allow get to do any processing and return the reference to that.

template<class T>
const T& ValueWrapperInterface< T >::operator= ( const T &  lval  )  [inline]

Assignment operator will invoke set.

template<class T>
virtual const T& ValueWrapperInterface< T >::get (  )  [inline, virtual]

Get the value associated with this interface.

Processing code can be done here for specialized implementations.

template<class T>
virtual const T& ValueWrapperInterface< T >::set ( const T &  t  )  [inline, virtual]

Set the value associated with this interface.

Validation/processing code can be done here. The copy-constructor uses the set method to do it's copy so be mindful of that, or specialize the copy-constructor.


Member Data Documentation

template<class T>
T* ValueWrapperInterface< T >::mValuePtr [protected]