|
MeVisLab Toolbox Reference
|
Basic list class template combining properties of ListBase and a vector of the template argument type. More...
#include <mlListBase.h>
Public Types | |
| typedef T | itemType |
| Public Types inherited from ml::ListBase | |
| enum | ActionClass { ActNone = 0 , ActUnknown , ActNew , ActSelect , ActModify , ActDelete , ActInsert , ActInsertOvw , ActNumActions } |
| Constants to describe the type of action most recently performed. More... | |
| Public Types inherited from ml::Base | |
| enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
| This enum describes the different persistence interfaces available. More... | |
Public Member Functions | |
Constructors | |
| ListTemplate () | |
| Standard constructor, disables persistence. | |
| ListTemplate (bool persistence) | |
| Special constructor to explicitly enable/disable persistence. | |
| ListTemplate (const ListTemplate &other) | |
Abstract list access | |
| size_t | getSize () const override |
| Get number of list elements. | |
| void | clearList () override |
| Clear complete list. | |
| ListTemplate< T > & | operator= (const ListTemplate< T > &list) |
| Assignment operator. | |
| ListTemplate< T > * | clone () const override |
| ListTemplate< T > * | deepCopy () const override |
| Create a deep copy of the list. | |
List persistence | |
| std::string | persistentState () const override |
| void | setPersistentState (const std::string &state) override |
| Initialize the list object from the string state. | |
| void | addStateToTree (TreeNode *parent) const override |
| Attaches the state as children of the given parent node. | |
| ML_SET_ADDSTATE_VERSION (2) | |
| Set addState version number, version 2 indicates data saved by a 64 bit version. | |
| void | readStateFromTree (TreeNode *parent) override |
| Reads the object state from the children of the given parent node. | |
| Public Member Functions inherited from ml::ListBase | |
| ListBase (bool persistence) | |
| Constructor. Derived class should indicate whether persistence is implemented. | |
| ListBase (const ListBase &other) | |
| void | setContainer (ListContainerBase *container) |
| ListContainerBase * | getContainer () const |
| virtual BaseItem * | getItemAt (MLssize_t) |
| virtual const BaseItem * | getConstItemAt (MLssize_t) const |
| Same as getItemAt(MLssize_t index) for constant access. | |
| virtual void | insertItemAt (MLssize_t, const BaseItem *) |
| virtual void | modifyItemAt (MLssize_t, const BaseItem *) |
| virtual void | deleteItemAt (MLssize_t) |
| virtual void | selectItemAt (MLssize_t) |
| virtual const RuntimeType * | getItemTypeId () const |
| virtual void | setAction (ActionClass actionClass, MLssize_t id, MLssize_t index) |
| Set actionClass, affected item id and index. | |
| virtual void | setAction (ActionClass actionClass) |
| Set actionClass for actions affecting the whole list. | |
| virtual void | getAction (ActionClass &actionClass, MLssize_t &id, MLssize_t &index) const |
| Get actionClass, affected item id and index. | |
| virtual ActionClass | getActionClass () const |
| Get actionClass of last action. | |
| virtual MLssize_t | getActionId () const |
| Get id of item affected by last action. | |
| virtual MLssize_t | getActionIndex () const |
| virtual MLssize_t | getCurrentIndex () const |
| Get index of currently selected item, or -1 if no item selected. | |
| virtual bool | isModified () const |
| Tests, if the last action has been an action that has modified the content of the list. | |
| virtual bool | hasPersistence () const |
| Test if persistence is available and enabled. | |
| virtual void | setPersistence (bool persistence) |
| Enable/disable persistence functionality. | |
| bool | hasPersistance () const |
| void | setPersistance (bool persistence) |
| ML_SET_ADDSTATE_VERSION (0) | |
| Set addState version number. | |
| 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 |
| virtual void | writeTo (AbstractPersistenceOutputStream *) const |
| virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Protected Member Functions | |
List item persistence | |
To implement persistence, overload getItemState() and setItemState(). Make sure that the string returned by getItemState() can be disposed by clearItemState(), or otherwise overload clearItemState() appropriately. The item's string representation may contain any character, including those used in the list string syntax: [],". The list persistence methods take care of quoting the item strings if necessary. | |
| virtual std::string | itemState (typename ListTemplate< T >::const_iterator it) const |
| virtual void | setItemState (typename ListTemplate< T >::iterator, const std::string &) |
| Initialize the item object from the string state. | |
| Protected Member Functions inherited from ml::ListBase | |
| char * | newString (const std::string &str) const |
| void | deleteString (char *str) const |
| Dispose a string allocated with newString(). | |
| ListBase & | operator= (const ListBase &list) |
| Assignment operator, used in derived list classes. | |
Additional Inherited Members | |
| static const char *const | ActionClassNames [ActNumActions] |
| Action class name constants. | |
Basic list class template combining properties of ListBase and a vector of the template argument type.
Basic list class template (derived from ListBase and std::vector) combining properties of ListBase and a vector of the template argument type. Implements persistence methods that iterate through the vector items and call corresponding persistence methods for each item.
To implement an instance of ListTemplate with a given type T, the following steps are necessary:
Definition at line 326 of file mlListBase.h.
| typedef T ml::ListTemplate< T >::itemType |
Declare type name for item type (this allows declarations like: ObjectList::itemType obj)
Definition at line 332 of file mlListBase.h.
|
inline |
Standard constructor, disables persistence.
Definition at line 339 of file mlListBase.h.
References ml::ListBase::ListBase().
Referenced by ml::BaseListTemplate< T >::addStateToTree(), addStateToTree(), ml::BaseListTemplate< T >::appendItem(), ml::BaseListTemplate< T >::BaseListTemplate(), ml::BaseListTemplate< T >::BaseListTemplate(), ml::BaseListTemplate< T >::BaseListTemplate(), ml::BaseListTemplate< T >::clearList(), clone(), deepCopy(), ml::BaseListTemplate< T >::doDeleteItem(), ml::BaseListTemplate< T >::doInsertItem(), ml::BaseListTemplate< T >::doModifyItem(), ml::BaseListTemplate< T >::doSelectItem(), ListTemplate(), operator=(), ml::BaseListTemplate< T >::readStateFromTree(), ml::BaseListTemplate< T >::resetId(), and ml::VecListTemplate< T >::VecListTemplate().
|
inline |
Special constructor to explicitly enable/disable persistence.
Definition at line 342 of file mlListBase.h.
References ml::ListBase::ListBase().
|
inline |
Definition at line 344 of file mlListBase.h.
References ml::ListBase::ListBase(), ListTemplate(), and T.
|
overridevirtual |
Attaches the state as children of the given parent node.
Attaches the state as children of the given parent node. BE SURE TO INCREASE THE VERSION NUMBER IN THE DECLARATION AND ADAPT readStateFromTree() TO THE NEW VERSION WHILE KEEPING IT DOWNWARD- COMPATIBLE!
Reimplemented from ml::ListBase.
Definition at line 525 of file mlListBase.h.
References ml::TreeNode::addChild(), addStateToTree(), itemState(), ml::ListBase::ListBase(), ListTemplate(), ML_ADDSTATE_SUPER, and ML_ADDSTATE_VERSION.
Referenced by addStateToTree().
|
inlineoverridevirtual |
Clear complete list.
Reimplemented from ml::ListBase.
Definition at line 357 of file mlListBase.h.
References ml::ListBase::clearList().
Referenced by readStateFromTree(), and setPersistentState().
|
overridevirtual |
Create a copy of (*this) using the ML runtime system and the '='-operator. Overwrite in derived classes if copying the list is not equivalent to copying the object (for instance, if the derived class has a global list description member). Returns NULL if a copy could not be created, or the cloned list otherwise.
Create a copy of (*this) using the ML runtime system. Overwrite in derived classes if copying the list is not equivalent to copying the object (for instance, if the derived class has a global list description member). Returns NULL if a copy could not be created, or the cloned list otherwise.
Reimplemented from ml::ListBase.
Definition at line 617 of file mlListBase.h.
References ml::RuntimeType::canCreateInstance(), clone(), ml::RuntimeType::createInstance(), and ListTemplate().
Referenced by clone(), and deepCopy().
|
inlineoverridevirtual |
Create a deep copy of the list.
Reimplemented from ml::ListBase.
Definition at line 379 of file mlListBase.h.
References clone(), and ListTemplate().
|
inlineoverridevirtual |
|
inlineprotectedvirtual |
Return a string representation of the item object. The string is allocated on the heap and is later disposed by clearItemState().
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 421 of file mlListBase.h.
Referenced by addStateToTree(), and persistentState().
| ml::ListTemplate< T >::ML_SET_ADDSTATE_VERSION | ( | 2 | ) |
Set addState version number, version 2 indicates data saved by a 64 bit version.
|
inline |
|
overridevirtual |
Return a string representation of the list object.
Reimplemented from ml::Base.
Definition at line 437 of file mlListBase.h.
References ml::ListBase::hasPersistence(), itemState(), ml::ListParser::needsQuote(), persistentState(), and ml::ListParser::quoteString().
Referenced by persistentState().
|
overridevirtual |
Reads the object state from the children of the given parent node.
Reimplemented from ml::ListBase.
Definition at line 553 of file mlListBase.h.
References ml::ListBase::ActNew, clearList(), ml::ListBase::hasPersistence(), ml::ListBase::ListBase(), ML_READCHILD_OPTIONAL, ML_READSTATE_SUPER, readStateFromTree(), ml::ListBase::setAction(), setItemState(), T, and ml::TNE_UnsupportedClassVersion.
Referenced by readStateFromTree().
|
inlineprotectedvirtual |
Initialize the item object from the string state.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 427 of file mlListBase.h.
Referenced by readStateFromTree(), and setPersistentState().
|
overridevirtual |
Initialize the list object from the string state.
Reimplemented from ml::Base.
Definition at line 480 of file mlListBase.h.
References ml::ListBase::ActNew, clearList(), ml::ListParser::getErrorMessage(), ml::ListBase::hasPersistence(), ml::ListParser::init(), ml::ParserBase::kEmptyString, ml::ParserBase::kEndOfSource, ML_EMPTY_MESSAGE, ML_PRINT_ERROR, ml::ListParser::nextItem(), ml::ListBase::setAction(), setItemState(), setPersistentState(), and T.
Referenced by setPersistentState().