cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Public Attributes | List of all members
cmnGenericObjectProxy< _elementType > Class Template Reference

#include <cmnGenericObjectProxy.h>

Inheritance diagram for cmnGenericObjectProxy< _elementType >:
cmnGenericObject

Public Types

typedef cmnGenericObjectProxy
< _elementType > 
ThisType
 
typedef _elementType value_type
 

Public Member Functions

 cmnGenericObjectProxy (void)
 
 cmnGenericObjectProxy (const value_type &data)
 
 ~cmnGenericObjectProxy (void)
 
ThisTypeoperator= (value_type data)
 
void SerializeRaw (std::ostream &outputStream) const
 
void DeSerializeRaw (std::istream &inputStream)
 
virtual void ToStream (std::ostream &outputStream) const
 
virtual void ToStreamRaw (std::ostream &outputStream, const char CMN_UNUSED(delimiter)= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
 
virtual bool FromStreamRaw (std::istream &inputStream, const char CMN_UNUSED(delimiter)= ' ')
 
 operator value_type & (void)
 
 operator const value_type & (void) const
 
- Public Member Functions inherited from cmnGenericObject
virtual ~cmnGenericObject (void)
 
virtual const
cmnClassServicesBase
Services (void) const =0
 
bool ReconstructFrom (const cmnGenericObject &other)
 
std::string ToString (void) const
 
virtual void ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const
 
virtual bool FromStreamRaw (std::istream &inputStream, const char delimiter= ' ')
 
virtual cmnLogger::StreamBufTypeGetLogMultiplexer (void) const
 
virtual size_t ScalarNumber (void) const
 
virtual bool ScalarNumberIsFixed (void) const
 
virtual double Scalar (const size_t CMN_UNUSED(index)) const throw (std::out_of_range)
 
virtual std::string ScalarDescription (const size_t CMN_UNUSED(index), const std::string &CMN_UNUSED(userDescription)) const
 

Public Attributes

value_type Data
 

Detailed Description

template<class _elementType>
class cmnGenericObjectProxy< _elementType >

Proxy class used to create a simple cmnGenericObject, i.e. data object with a registered type, dynamic creation, serialization and de-serialization. The proxy object contains one data member of the actual type provided as a template parameter.

For example, to create a cmnGenericObject from an existing type, one would have to specialize cmnGenericObjectProxy as follows in the header file:

class UserType {
....
};
typedef cmnGenericObjectProxy<UserType> UserTypeProxy;

It is also required to instantiate the associated services in the compiled code (.cpp) file with:

Note
It is really important to note that this simple way of creating cmnGenericObject derived classes works as is for classes which can be serialized as a memory block, i.e. native types, compact structs, ... For classes which require a more complex way to serialize and deserialize, the user will also have to overload the functions cmnSerializeRaw and cmnDeSerializeRaw.
As it is, this class can not be used in libraries other than cisstCommon if a DLL is to be created. The issue is that the class will be declared as imported in the header file because it is part of cisstCommon.
See Also
cmnGenericObject, cmnClassServices, cmnSerializer, cmnDeSerializer
Parameters
_elementTypeThe actual type for which we want to provide a proxy object.

Member Typedef Documentation

template<class _elementType >
typedef cmnGenericObjectProxy<_elementType> cmnGenericObjectProxy< _elementType >::ThisType
template<class _elementType >
typedef _elementType cmnGenericObjectProxy< _elementType >::value_type

Constructor & Destructor Documentation

template<class _elementType >
cmnGenericObjectProxy< _elementType >::cmnGenericObjectProxy ( void  )
inline

Default constructor. The data member is initialized using its default constructor.

template<class _elementType >
cmnGenericObjectProxy< _elementType >::cmnGenericObjectProxy ( const value_type data)
inline

Conversion constructor. This allows to construct the proxy object using an object of the actual type.

template<class _elementType >
cmnGenericObjectProxy< _elementType >::~cmnGenericObjectProxy ( void  )
inline

Member Function Documentation

template<class _elementType >
void cmnGenericObjectProxy< _elementType >::DeSerializeRaw ( std::istream &  inputStream)
inlinevirtual

DeSerialization. Relies on the specialization, if any, of cmnDeSerializeRaw.

Reimplemented from cmnGenericObject.

template<class _elementType >
virtual bool cmnGenericObjectProxy< _elementType >::FromStreamRaw ( std::istream &  inputStream,
const char   CMN_UNUSEDdelimiter = ' ' 
)
inlinevirtual

From stream raw data.

template<class _elementType >
cmnGenericObjectProxy< _elementType >::operator const value_type & ( void  ) const
inline
template<class _elementType >
cmnGenericObjectProxy< _elementType >::operator value_type & ( void  )
inline

Cast operator. This allows to assign to an object of the actual type without explicitly referencing the public data member "Data".

template<class _elementType >
ThisType& cmnGenericObjectProxy< _elementType >::operator= ( value_type  data)
inline

Conversion assignment. This allows to assign from an object of the actual type without explicitly referencing the public data member "Data".

template<class _elementType >
void cmnGenericObjectProxy< _elementType >::SerializeRaw ( std::ostream &  outputStream) const
inlinevirtual

Serialization. Relies on the specialization, if any, of cmnSerializeRaw.

Reimplemented from cmnGenericObject.

template<class _elementType >
virtual void cmnGenericObjectProxy< _elementType >::ToStream ( std::ostream &  outputStream) const
inlinevirtual

To stream method. Uses the default << operator as defined for the actual type.

Reimplemented from cmnGenericObject.

template<class _elementType >
virtual void cmnGenericObjectProxy< _elementType >::ToStreamRaw ( std::ostream &  outputStream,
const char   CMN_UNUSEDdelimiter = ' ',
bool  headerOnly = false,
const std::string &  headerPrefix = "" 
) const
inlinevirtual

To stream raw data.

Member Data Documentation

template<class _elementType >
value_type cmnGenericObjectProxy< _elementType >::Data

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