MeVisLabToolboxReference
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

List of all members.

Public Member Functions

void setId (MLssize_t id)
 Sets the id of the item.
MLssize_t getId () const
 Sets the id of the item.
virtual ~BaseItem ()
 Destructor.
virtual BaseItemoperator= (const BaseItem &item)
 Assignment operator.
bool operator< (const BaseItem &) const
 Dummy "lesser than operator", required for VC7.
bool operator== (const BaseItem &) const
 Dummy "equal operator", required for VC7.
const char * name () const
 Get name.
void setName (const char *newName)
 Set name, object stores a copy.
virtual BaseItemdeepCopy () const
 Create a deep copy of the BaseItem.
Constructors
 BaseItem ()
 Default constructor.
 BaseItem (MLssize_t id, const char *nameStr=NULL)
 ID and name.
 BaseItem (const BaseItem &item)
 Copy constructor.
Persistence
virtual char * getPersistentState () const
 Return a string representation of the item object.
virtual void setPersistentState (const char *state)
 Initialize the item object from the string state.
virtual void clearPersistentState (char *state) const
 Dispose the string state, which has been previously obtained by getPersistentState()
virtual void addStateToTree (TreeNode *parent) const
 Attaches the object state as children of the given parent node.
 ML_SET_ADDSTATE_VERSION (0)
 Set addState version number.
virtual void readStateFromTree (TreeNode *parent)
 Reads the object state from the children of the given parent node.
virtual void writeTo (AbstractPersistenceOutputStream *stream) const
 write state to stream
virtual void readFrom (AbstractPersistenceInputStream *stream, int version)
 read state from stream

Protected Member Functions

char * newString (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()

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

ml::BaseItem::BaseItem ( ) [inline]

Default constructor.

Definition at line 45 of file mlBaseItem.h.

ml::BaseItem::BaseItem ( MLssize_t  id,
const char *  nameStr = NULL 
) [inline]

ID and name.

Definition at line 48 of file mlBaseItem.h.

ml::BaseItem::BaseItem ( const BaseItem item) [inline]

Copy constructor.

Definition at line 51 of file mlBaseItem.h.

virtual ml::BaseItem::~BaseItem ( ) [inline, virtual]

Destructor.

Definition at line 62 of file mlBaseItem.h.


Member Function Documentation

virtual void ml::BaseItem::addStateToTree ( TreeNode parent) const [virtual]

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

Reimplemented from ml::Base.

Reimplemented in ml::BaseContainerItem, and ml::XMarker.

virtual void ml::BaseItem::clearPersistentState ( char *  state) const [virtual]

Dispose the string state, which has been previously obtained by getPersistentState()

Reimplemented from ml::Base.

Reimplemented in ml::BaseContainerItem.

virtual BaseItem* ml::BaseItem::deepCopy ( ) const [inline, virtual]

Create a deep copy of the BaseItem.

Reimplemented from ml::Base.

Definition at line 118 of file mlBaseItem.h.

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

Dispose a string allocated with newString()

MLssize_t ml::BaseItem::getId ( void  ) const [inline]

Sets the id of the item.

Definition at line 59 of file mlBaseItem.h.

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

virtual char* ml::BaseItem::getPersistentState ( ) const [virtual]

Return a string representation of the item object.

The string is allocated on the heap and is later disposed by clearPersistentState().

Reimplemented from ml::Base.

Reimplemented in ml::BaseContainerItem, and ml::XMarker.

ml::BaseItem::ML_SET_ADDSTATE_VERSION ( )

Set addState version number.

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

Reimplemented in ml::BaseContainerItem, and ml::XMarker.

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

Get name.

Definition at line 76 of file mlBaseItem.h.

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

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.

bool ml::BaseItem::operator< ( const BaseItem ) const [inline]

Dummy "lesser than operator", required for VC7.

Definition at line 69 of file mlBaseItem.h.

virtual BaseItem& ml::BaseItem::operator= ( const BaseItem item) [virtual]

Assignment operator.

bool ml::BaseItem::operator== ( const BaseItem ) const [inline]

Dummy "equal operator", required for VC7.

Definition at line 72 of file mlBaseItem.h.

virtual void ml::BaseItem::readFrom ( AbstractPersistenceInputStream stream,
int  version 
) [virtual]

read state from stream

Reimplemented from ml::Base.

virtual void ml::BaseItem::readStateFromTree ( TreeNode parent) [virtual]

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

Reimplemented from ml::Base.

Reimplemented in ml::BaseContainerItem, and ml::XMarker.

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

Sets the id of the item.

Definition at line 56 of file mlBaseItem.h.

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

Set name, object stores a copy.

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

virtual void ml::BaseItem::setPersistentState ( const char *  state) [virtual]

Initialize the item object from the string state.

Reimplemented from ml::Base.

Reimplemented in ml::BaseContainerItem, and ml::XMarker.

virtual void ml::BaseItem::writeTo ( AbstractPersistenceOutputStream stream) const [virtual]

write state to stream

Reimplemented from ml::Base.


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