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 charname () 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
 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.
 
virtual std::string detailString () const
 Return a string describing this object.
 
virtual bool implementsPersistence (PersistenceInterface) const
 Override this method to declare which persistence interfaces are implemented by your derived class.
 

Protected Member Functions

charnewString (const std::string &str) const
 Convenience method to create a copy of the string str allocated on the heap.
 
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.

◆ 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 mlrange_cast().

◆ BaseItem() [3/3]

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

Copy constructor.

Definition at line 51 of file mlBaseItem.h.

References mlrange_cast().

◆ ~BaseItem()

ml::BaseItem::~BaseItem ( )
inlineoverride

Destructor.

Definition at line 62 of file mlBaseItem.h.

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 107 of file mlBaseItem.h.

◆ deleteString()

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

Dispose a string allocated with newString()

◆ getId()

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

Sets the id of the item.

Definition at line 59 of file mlBaseItem.h.

◆ 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

Get name.

Definition at line 70 of file mlBaseItem.h.

◆ 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.

◆ 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 56 of file mlBaseItem.h.

Referenced by ml::ListContainerTemplate< T >::insertItem().

◆ setName()

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

Set name, object stores a copy.

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

◆ 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: