MeVisLab Toolbox Reference
ml::BaseItem Class Reference

General Base object class for list items that have an id and a name. More...

#include <mlBaseItem.h>

Inheritance diagram for ml::BaseItem:
ml::Base ml::BaseContainerItem ml::XMarker

Public Member Functions

void setId (MLssize_t id)
 Sets the id of the item.
MLssize_t getId () const
 Sets the id of the item.
 ~BaseItem () override
 Destructor.
BaseItemoperator= (const BaseItem &item)
 Assignment operator.
const char * name () const
 Get name.
void setName (const char *newName)
 Set name, object stores a copy.
BaseItemdeepCopy () const override
 Create a deep copy of the BaseItem.
Constructors
 BaseItem ()
 Default constructor.
 BaseItem (MLssize_t id, const char *nameStr=nullptr)
 ID and name.
 BaseItem (const BaseItem &item)
 Copy constructor.
Persistence
std::string persistentState () const override
 Return a string representation of the item object.
void setPersistentState (const std::string &state) override
 Initialize the item object from the string state.
void addStateToTree (TreeNode *parent) const override
 Attaches the object state as children of the given parent node.
 ML_SET_ADDSTATE_VERSION (0)
 Set addState version number.
void readStateFromTree (TreeNode *parent) override
 Reads the object state from the children of the given parent node.
void writeTo (AbstractPersistenceOutputStream *stream) const override
 write state to stream
void readFrom (AbstractPersistenceInputStream *stream, int version) override
 read state from stream
Public Member Functions inherited from ml::Base
 Base ()
 Constructor.
virtual ~Base ()
 Destructor.
bool isOfAllowedType (const std::vector< const RuntimeType * > &types) const
virtual bool isRefCountedBase () const
 Returns whether the instance is derived from RefCountedBase.
virtual std::string detailString () const
virtual bool implementsPersistence (PersistenceInterface) const

Protected Member Functions

char * newString (const std::string &str) const
void deleteString (char *str) const
 Dispose a string allocated with newString().

Additional Inherited Members

Public Types inherited from ml::Base
enum  PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream }
 This enum describes the different persistence interfaces available. More...

Detailed Description

General Base object class for list items that have an id and a name.

Definition at line 37 of file mlBaseItem.h.

Constructor & Destructor Documentation

◆ BaseItem() [1/3]

ml::BaseItem::BaseItem ( )
inline

Default constructor.

Definition at line 45 of file mlBaseItem.h.

References ml::Base::Base().

Referenced by BaseItem(), deepCopy(), deleteString(), operator=(), and ml::XMarker::XMarker().

◆ BaseItem() [2/3]

ml::BaseItem::BaseItem ( MLssize_t id,
const char * nameStr = nullptr )
inline

ID and name.

Definition at line 48 of file mlBaseItem.h.

References ml::Base::Base(), and setName().

◆ BaseItem() [3/3]

ml::BaseItem::BaseItem ( const BaseItem & item)
inline

Copy constructor.

Definition at line 51 of file mlBaseItem.h.

References ml::Base::Base(), BaseItem(), getId(), name(), setId(), and setName().

◆ ~BaseItem()

ml::BaseItem::~BaseItem ( )
inlineoverride

Destructor.

Definition at line 68 of file mlBaseItem.h.

References setName().

Member Function Documentation

◆ addStateToTree()

void ml::BaseItem::addStateToTree ( TreeNode * parent) const
overridevirtual

Attaches the object state as children of the given parent node.

Reimplemented from ml::Base.

Reimplemented in ml::XMarker.

◆ deepCopy()

BaseItem * ml::BaseItem::deepCopy ( ) const
inlineoverridevirtual

Create a deep copy of the BaseItem.

Reimplemented from ml::Base.

Definition at line 113 of file mlBaseItem.h.

References BaseItem().

◆ deleteString()

void ml::BaseItem::deleteString ( char * str) const
protected

Dispose a string allocated with newString().

References BaseItem().

◆ getId()

MLssize_t ml::BaseItem::getId ( ) const
inline

Sets the id of the item.

Definition at line 65 of file mlBaseItem.h.

Referenced by BaseItem(), and ml::ListContainerTemplate< T >::updatePropertyFields().

◆ ML_SET_ADDSTATE_VERSION()

ml::BaseItem::ML_SET_ADDSTATE_VERSION ( 0 )

Set addState version number.

Version History: 0 : adding size and items only 1 : also adding ListBase members (hasPersistence, currentItem);

◆ name()

const char * ml::BaseItem::name ( ) const
inline

◆ newString()

char * ml::BaseItem::newString ( const std::string & str) const
protected

Convenience method to create a copy of the string str allocated on the heap. This avoids passing STL strings between modules, which fails in Windows due to a bug in the VC++ implementation of the STL.

◆ operator=()

BaseItem & ml::BaseItem::operator= ( const BaseItem & item)

Assignment operator.

References BaseItem().

◆ persistentState()

std::string ml::BaseItem::persistentState ( ) const
overridevirtual

Return a string representation of the item object.

Reimplemented from ml::Base.

Reimplemented in ml::XMarker.

◆ readFrom()

void ml::BaseItem::readFrom ( AbstractPersistenceInputStream * stream,
int version )
overridevirtual

read state from stream

Reimplemented from ml::Base.

◆ readStateFromTree()

void ml::BaseItem::readStateFromTree ( TreeNode * parent)
overridevirtual

Reads the object state from the children of the given parent node.

Reimplemented from ml::Base.

Reimplemented in ml::XMarker.

◆ setId()

void ml::BaseItem::setId ( MLssize_t id)
inline

Sets the id of the item.

Definition at line 62 of file mlBaseItem.h.

Referenced by BaseItem().

◆ setName()

void ml::BaseItem::setName ( const char * newName)

Set name, object stores a copy.

Referenced by BaseItem(), BaseItem(), ml::XMarker::XMarker(), ml::XMarker::XMarker(), and ~BaseItem().

◆ setPersistentState()

void ml::BaseItem::setPersistentState ( const std::string & state)
overridevirtual

Initialize the item object from the string state.

Reimplemented from ml::Base.

Reimplemented in ml::XMarker.

◆ writeTo()

void ml::BaseItem::writeTo ( AbstractPersistenceOutputStream * stream) const
overridevirtual

write state to stream

Reimplemented from ml::Base.


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