MeVisLabToolboxReference
ml::Base Class Reference

Class representing general ML objects that support import/export via strings (setPersistentState() and getPersistentState()), arbitrary tree structures (using addStateToTree() and readStateFromTree()) or a data stream (using writeTo() and readFrom()). More...

#include <mlBase.h>

Inheritance diagram for ml::Base:
ml::BaseItem ml::BitImage ml::CSOProcessorData ml::CSOVisualizationSettings ml::CSOVoxelSetList ml::CurveData ml::CurveList ml::DataCompressor ml::DataCompressorFactory ml::DiscList ml::EventSource ml::FieldContainer ml::Graph ml::ITKWrapperBase ml::ListBase ml::LUTFunction ml::MarkerList ml::MLVTKParentWrapper ml::MultiBaseType ml::omObject ml::omObjectContainer ml::omObjMgrConnection ml::PointList ml::PropertyContainer ml::PropertyManager ml::RasterFunction ml::RasterFunctionList ml::SphereList ml::StylePalette ml::VectorList ml::VTKWrapperBase

List of all members.

Public Member Functions

 Base ()
 Constructor.
virtual ~Base ()
 Destructor.
virtual BasedeepCopy () const
 Creates a deep copy of the given object.
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
 Check if this object's type is equal to or derived from one of the types given in the argument.
virtual bool isRefCountedBase () const
 Returns if the instance is derived from RefCountedBase.

Persistence interfaces

enum  PersistenceInterface { PersistenceByString, PersistenceByTreeNode, PersistenceByStream }
 This enum describes the different persistence interfaces available. More...
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class.
virtual char * getPersistentState () const ML_RETURN_VALUE_SHOULD_BE_USED
 Returns a C string describing the object's internal state.
virtual void setPersistentState (const char *)
 Restores the object's internal state from a string that had been previously generated using getPersistentState().
virtual void clearPersistentState (char *) const
 Disposes a string previously allocated by getPersistentState().
virtual void addStateToTree (TreeNode *) const
 Attaches the object state as children of the given parent node.
virtual void readStateFromTree (TreeNode *)
 Reads the object state from the children of the given parent node.
virtual void writeTo (AbstractPersistenceOutputStream *) const
 Write the objects state to the data stream object.
virtual void readFrom (AbstractPersistenceInputStream *, int)
 Read the objects state from the data stream object.
 ML_PERSISTENCE_VERSION (0)
 Set addStateToTree version number that can be accessed via getAddStateVersion()

Detailed Description

Class representing general ML objects that support import/export via strings (setPersistentState() and getPersistentState()), arbitrary tree structures (using addStateToTree() and readStateFromTree()) or a data stream (using writeTo() and readFrom()).

Objects of class Base

  • can be represented using the field concept (class BaseField)
  • provide an interface to allow the import/export of a persistent representation of an object's internal state.

Remark: This class is base class for Module and all derived modules.

Definition at line 58 of file mlBase.h.


Member Enumeration Documentation

This enum describes the different persistence interfaces available.

can be implemented in derived classes:

Enumerator:
PersistenceByString 
PersistenceByTreeNode 
PersistenceByStream 

Definition at line 74 of file mlBase.h.


Constructor & Destructor Documentation

ml::Base::Base ( )

Constructor.

virtual ml::Base::~Base ( ) [virtual]

Destructor.


Member Function Documentation

virtual Base* ml::Base::deepCopy ( ) const [inline, virtual]
virtual bool ml::Base::implementsPersistence ( PersistenceInterface  ) const [inline, virtual]

Override this method to declare which persistence interfaces are implemented by your derived class.

Reimplemented in ml::StandardItemModel.

Definition at line 82 of file mlBase.h.

bool ml::Base::isOfAllowedType ( const std::vector< const RuntimeType * > &  types) const

Check if this object's type is equal to or derived from one of the types given in the argument.

This method will also return true if the vector is empty, since this denotes that any type is allowed.

virtual bool ml::Base::isRefCountedBase ( ) const [inline, virtual]

Returns if the instance is derived from RefCountedBase.

Reimplemented in ml::RefCountedBase.

Definition at line 138 of file mlBase.h.

ml::Base::ML_PERSISTENCE_VERSION ( )

Set addStateToTree version number that can be accessed via getAddStateVersion()

virtual void ml::Base::readFrom ( AbstractPersistenceInputStream ,
int   
) [inline, virtual]

Read the objects state from the data stream object.

version is the version number given through ML_PERSISTENCE_VERSION at the time the object was written to the AbstractPersistenceOutStream.

Include mlAbstractPersistenceStream.h for the implementation of this method.

If you are sub-classing from another Base class that implements persistence, use the macro ML_READFROM_SUPER() to load the super-class data, because this takes care of reading and checking the version number of the super class.

Reimplemented in ml::BaseItem, and ml::StandardItemModel.

Definition at line 120 of file mlBase.h.

virtual void ml::Base::writeTo ( AbstractPersistenceOutputStream ) const [inline, virtual]

Write the objects state to the data stream object.

Include mlAbstractPersistenceStream.h for the implementation of this method.

If you are sub-classing from another Base class that implements persistence, use the macro ML_WRITETO_SUPER() to save the super-class data, because this takes care of writing the version number of the super class.

Reimplemented in ml::BaseItem, and ml::StandardItemModel.

Definition at line 109 of file mlBase.h.


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