cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
cmnGenericObject Class Referenceabstract

Base class for high level objects. More...

#include <cmnGenericObject.h>

Inheritance diagram for cmnGenericObject:
cmnCommandLineOptions cmnDeSerializer cmnGenericObjectProxy< _elementType > cmnLoggerQtWidget cmnPath cmnSerializer mtsATINetFTConfig mtsCMUSphinx4::Context mtsCMUSphinx4::WordActions mtsComponent mtsGenericObject mtsInterface mtsInterfaceProvidedOrOutput mtsInterfaceRequiredOrInput mtsIntuitiveResearchKitConsoleQt mtsManagerComponentServices mtsManagerGlobalInterface mtsManagerLocalInterface mtsQtWidgetEvent mtsQtWidgetFunction mtsQtWidgetGenericObjectRead mtsQtWidgetInterfaceRequired mtsStateTable mtsVFController mtsWatchdogClient mtsWatchdogServer osaOpenAL osaSerialPort osaSocket osaSocketServer osaTimeServer prmTransformationManager sawATINetFTSimulatorQtWidget sawATINetFTSimulatorQtWidget svlImageCodecBase svlQtWidgetFileOpen svlQtWidgetFramerate svlVidCapSrcBase svlWebObjectBase svlWebPublisher

Public Member Functions

virtual ~cmnGenericObject (void)
 
virtual const
cmnClassServicesBase
Services (void) const =0
 
bool ReconstructFrom (const cmnGenericObject &other)
 
std::string ToString (void) const
 
virtual void ToStream (std::ostream &outputStream) 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 void SerializeRaw (std::ostream &outputStream) const
 
virtual void DeSerializeRaw (std::istream &inputStream)
 
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
 

Detailed Description

Base class for high level objects.

See Also
cmnClassRegister cmnClassServiceBase

Constructor & Destructor Documentation

virtual cmnGenericObject::~cmnGenericObject ( void  )
inlinevirtual

Destructor. Does nothing specific.

Member Function Documentation

virtual void cmnGenericObject::DeSerializeRaw ( std::istream &  inputStream)
virtual

De-serialize the content of the object without any extra information, i.e. no class type nor format version.

Reimplemented in mtsGenericObjectProxyRef< _elementType >, mtsGenericObjectProxy< _elementType >, mtsGenericObjectProxy< double >, mtsGenericObjectProxy< std::string >, mtsGenericObjectProxy< float >, mtsGenericObjectProxy< int >, mtsGenericObjectProxy< bool >, svlSampleImageCustom< _ValueType, _DataChannels, _VideoChannels >, svlSampleImageCustom< float, 3, 1 >, svlSampleImageCustom< unsigned char, 3, 1 >, prmPositionCartesianSet, prmVelocityCartesianSet, prmFixtureGainCartesianSet, svlSampleMatrixCustom< _ValueType >, svlSampleMatrixCustom< float >, mtsStateIndex, mtsIntervalStatistics, prmActuatorState, mtsGenericObject, mtsMatrix< _elementType >, mtsMatrix< double >, prmMaskedVector< _elementType >, cmnGenericObjectProxy< _elementType >, prmGainParameters, mtsVector< _elementType >, mtsVector< double >, mtsVector< short >, mtsVector< unsigned char >, mtsVector< bool >, mtsSocketProxyInitData, mtsStealthTool, prmVelocityCartesianGet, prmVelocityJointSet, mtsFixedSizeVector< _elementType, _size >, mtsLogMessage, prmIMUSensors, prmStateJoint, prmMotionBase, prmPositionJointSet, prmForceCartesianSet, prmVelocityJointGet, mtsConnection, prmForceCartesianGet, prmPositionCartesianGet, prmActuatorParameters, prmEventButton, prmForceTorqueJointSet, prmPositionJointGet, mtsStealthTool, mtsComponentConstructorNameAndArg< T >, prmRobotState, mtsEventHandlerList, svlSampleCameraGeometry, mtsQtApplicationConstructorArg, mtsSocketProxyServerConstructorArg, ireTaskConstructorArg, mtsSocketProxyClientConstructorArg, mtsTaskPeriodicConstructorArg, svlSampleImage, mtsTaskContinuousConstructorArg, svlSampleMatrix, svlSampleBlobs, svlSampleTargets, svlSampleText, svlSampleTransform3D, svlSample, and svlSampleCUDAImage.

virtual bool cmnGenericObject::FromStreamRaw ( std::istream &  inputStream,
const char  delimiter = ' ' 
)
virtual
virtual cmnLogger::StreamBufType* cmnGenericObject::GetLogMultiplexer ( void  ) const
virtual

Get the multiplexer to use for logging. This is used by the macro CMN_LOG_CLASS to determine the log destination. By default, it uses cmnLogger. This method can be overloaded to define a log file/stream per object.

Reimplemented in mtsComponent.

bool cmnGenericObject::ReconstructFrom ( const cmnGenericObject other)

Use the placement new with the copy constructor to re-construct this object based on an existing one. This method will call the destructor to free any memory allocated by the previous constructor. It is important to note that the memory allocated for the object itself is not freed/re-allocated and therefore the object's address remains valid.

An object of the same type, if the types (class derived from cmnGenericObject) don't correspond the method will return false and will not call the destructor and copy constructor.

Returns
false if the object other is not of the right type.
virtual double cmnGenericObject::Scalar ( const size_t   CMN_UNUSEDindex) const
throw (std::out_of_range
)
inlinevirtual

Return the index-th (zero-based) value of data typecasted to double. Note that this method will throw an exception of type std::outputStream if the index exceeds the number of scalars.

virtual std::string cmnGenericObject::ScalarDescription ( const size_t   CMN_UNUSEDindex,
const std::string &  CMN_UNUSEDuserDescription 
) const
inlinevirtual

Return the name of index-th (zero-based) data typecasted to double. As for the Scalar, this method will throw an exception of type std::out_of_range if the index exceeds the number of scalar.

virtual size_t cmnGenericObject::ScalarNumber ( void  ) const
inlinevirtual

Methods for data visualization. Derived classes should override the following methods in order to be properly processed by the data visualizer of the global component manager.

Return a number of data (which can be visualized, i.e., type-casted to double)

Reimplemented in prmFixtureGainCartesianSet, mtsGenericObject, prmIMUSensors, prmStateJoint, prmPositionCartesianGet, and prmPositionJointGet.

virtual bool cmnGenericObject::ScalarNumberIsFixed ( void  ) const
inlinevirtual

Indicates if this object has a fixed number of scalars. This is used for arrays of object in order to optimize random access for a given scalar. When defining an object with a fixed number of scalars, overloading this method to return true allows some optimizations.

Reimplemented in prmFixtureGainCartesianSet, mtsGenericObject, prmIMUSensors, prmStateJoint, prmPositionCartesianGet, and prmPositionJointGet.

virtual void cmnGenericObject::SerializeRaw ( std::ostream &  outputStream) const
virtual

Serialize the content of the object without any extra information, i.e. no class type nor format version. The "receiver" is supposed to already know what to expect.

Reimplemented in mtsGenericObjectProxyRef< _elementType >, mtsGenericObjectProxy< _elementType >, mtsGenericObjectProxy< double >, mtsGenericObjectProxy< std::string >, mtsGenericObjectProxy< float >, mtsGenericObjectProxy< int >, mtsGenericObjectProxy< bool >, svlSampleImageCustom< _ValueType, _DataChannels, _VideoChannels >, svlSampleImageCustom< float, 3, 1 >, svlSampleImageCustom< unsigned char, 3, 1 >, prmPositionCartesianSet, prmVelocityCartesianSet, prmFixtureGainCartesianSet, svlSampleMatrixCustom< _ValueType >, svlSampleMatrixCustom< float >, mtsStateIndex, mtsIntervalStatistics, prmActuatorState, mtsGenericObject, mtsMatrix< _elementType >, mtsMatrix< double >, cmnGenericObjectProxy< _elementType >, prmMaskedVector< _elementType >, mtsSocketProxyInitData, mtsStealthTool, mtsVector< _elementType >, mtsVector< double >, mtsVector< short >, mtsVector< unsigned char >, mtsVector< bool >, mtsLogMessage, prmVelocityCartesianGet, prmVelocityJointSet, prmGainParameters, prmIMUSensors, mtsFixedSizeVector< _elementType, _size >, prmStateJoint, prmMotionBase, prmPositionJointSet, prmForceCartesianSet, prmVelocityJointGet, mtsConnection, prmForceCartesianGet, prmPositionCartesianGet, prmPositionJointGet, prmActuatorParameters, prmEventButton, prmForceTorqueJointSet, mtsStealthTool, mtsEventHandlerList, svlSampleCameraGeometry, prmRobotState, mtsComponentConstructorNameAndArg< T >, mtsQtApplicationConstructorArg, mtsSocketProxyServerConstructorArg, ireTaskConstructorArg, mtsSocketProxyClientConstructorArg, mtsTaskPeriodicConstructorArg, svlSampleImage, mtsTaskContinuousConstructorArg, svlSampleMatrix, svlSampleBlobs, svlSampleTargets, svlSampleText, svlSampleTransform3D, svlSample, and svlSampleCUDAImage.

virtual const cmnClassServicesBase* cmnGenericObject::Services ( void  ) const
pure virtual

Pure virtual method to access the class services. The derived classes should always declare and implement this method using the macros CMN_DECLARE_SERVICES, CMN_DECLARE_SERVICES_INSTANTIATION and CMN_IMPLEMENT_SERVICES. In NO WAY, a user should redefine/overload this method otherwise.

Returns
A pointer on the class services. This points to the unique instance of cmnClassServiceBase for a given class.
See Also
cmnClassRegister cmnClassServiceBase

Implemented in mtsGenericObjectProxyBase< _elementType >, mtsGenericObjectProxyBase< double >, mtsGenericObjectProxyBase< std::string >, mtsGenericObjectProxyBase< float >, mtsGenericObjectProxyBase< int >, and mtsGenericObjectProxyBase< bool >.

virtual void cmnGenericObject::ToStream ( std::ostream &  outputStream) const
virtual

The default ToStream method returns the name of the class. This method must be overloaded to provide a useful message.

Reimplemented in mtsManagerLocal, mtsGenericObjectProxyRef< _elementType >, mtsInterfaceProvided, mtsComponent, mtsStateTable, mtsGenericObjectProxy< _elementType >, mtsGenericObjectProxy< double >, mtsGenericObjectProxy< std::string >, mtsGenericObjectProxy< float >, mtsGenericObjectProxy< int >, mtsGenericObjectProxy< bool >, mtsInterfaceRequired, mtsStealthProbeCal, prmFixtureGainCartesianSet, mtsStealthRegistration, mtsStealthProbeCal, cmnPath, mtsStealthFrame, mtsStateIndex, mtsStealthRegistration, prmActuatorState, cmnGenericObjectProxy< _elementType >, mtsIntervalStatistics, mtsGenericObject, mtsSocketProxyInitData, mtsHistory< _elementType >, prmMaskedVector< _elementType >, mtsStealthTool, mtsStealthFrame, mtsLogMessage, mtsMatrix< _elementType >, mtsMatrix< double >, prmIMUSensors, prmStateJoint, prmVelocityCartesianGet, mtsVector< _elementType >, mtsVector< double >, mtsVector< short >, mtsVector< unsigned char >, mtsVector< bool >, prmGainParameters, mtsComponentConstructorNameAndArg< T >, mtsConnection, mtsFixedSizeVector< _elementType, _size >, prmPositionCartesianGet, prmPositionJointGet, prmForceCartesianSet, prmVelocityJointGet, prmForceCartesianGet, mtsStealthTool, mtsEventHandlerList, mtsQtApplicationConstructorArg, prmEventButton, mtsSocketProxyServerConstructorArg, ireTaskConstructorArg, prmRobotState, mtsSocketProxyClientConstructorArg, mtsTaskPeriodicConstructorArg, and mtsTaskContinuousConstructorArg.

virtual void cmnGenericObject::ToStreamRaw ( std::ostream &  outputStream,
const char  delimiter = ' ',
bool  headerOnly = false,
const std::string &  headerPrefix = "" 
) const
virtual

Unformatted text output. Delimiter can be used to create CSV data files if the object requires multiple values (e.g. vector, matrix, ). When headerOnly is set to true, the method should create a label for each value (e.g. v1, v2, v3). The prefix can be used to generated a more useful label (e.g. position-v1)

Reimplemented in mtsGenericObjectProxyRef< _elementType >, mtsGenericObjectProxy< _elementType >, mtsGenericObjectProxy< double >, mtsGenericObjectProxy< std::string >, mtsGenericObjectProxy< float >, mtsGenericObjectProxy< int >, mtsGenericObjectProxy< bool >, mtsStealthProbeCal, prmFixtureGainCartesianSet, mtsStealthRegistration, mtsStealthProbeCal, mtsStealthFrame, mtsStateIndex, mtsStealthRegistration, mtsIntervalStatistics, mtsGenericObject, mtsSocketProxyInitData, mtsHistory< _elementType >, mtsStealthTool, mtsStealthFrame, mtsMatrix< _elementType >, mtsMatrix< double >, prmIMUSensors, mtsVector< _elementType >, mtsVector< double >, mtsVector< short >, mtsVector< unsigned char >, mtsVector< bool >, prmVelocityCartesianGet, prmStateJoint, mtsFixedSizeVector< _elementType, _size >, mtsComponentConstructorNameAndArg< T >, mtsStateTable::IndexRange, prmPositionCartesianGet, prmForceCartesianSet, prmVelocityJointGet, prmPositionJointGet, prmForceCartesianGet, mtsStealthTool, mtsQtApplicationConstructorArg, prmEventButton, mtsSocketProxyServerConstructorArg, ireTaskConstructorArg, mtsSocketProxyClientConstructorArg, mtsTaskPeriodicConstructorArg, and mtsTaskContinuousConstructorArg.

std::string cmnGenericObject::ToString ( void  ) const

Formatted IO to a string. This method relies on ToStream which should be overloaded for each class.


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