|
MeVisLab Toolbox Reference
|
Base object template list class for list item classes derived from BaseItem. More...
#include <mlListBase.h>
Public Member Functions | |
| BaseListTemplate< T > & | operator= (const BaseListTemplate &other)=default |
| explicitly create default assignment operator | |
| BaseItem * | getItemAt (MLssize_t index) override |
| const BaseItem * | getConstItemAt (MLssize_t index) const override |
| Same as getItemAt(MLssize_t index) for constant access. | |
| void | insertItemAt (MLssize_t index, const BaseItem *item) override |
| void | modifyItemAt (MLssize_t index, const BaseItem *item) override |
| void | deleteItemAt (MLssize_t index) override |
| void | selectItemAt (MLssize_t index) override |
| const RuntimeType * | getItemTypeId () const override |
| void | clearList () override |
| Clear complete list. | |
Constructors | |
| BaseListTemplate () | |
| Standard constructor, disables persistence. | |
| BaseListTemplate (bool persistence) | |
| Special constructor to explicitly enable/disable persistence. | |
| BaseListTemplate (const BaseListTemplate &other) | |
Next-id support | |
| virtual MLssize_t | newId () |
| Get new unused id. | |
| virtual void | usedId (MLssize_t id) |
| Notify list that id is used. | |
| virtual void | resetId () |
| Reset next id. | |
List modification methods | |
These methods combine list modifications (via the STL vector interface) with the corresponding updates of the last action properties. They are provided for convenience when only a single modification is performed and the field to which the list might be connected is touched directly after this modification. Do not use these methods if several modifications are performed before the list field is touched. | |
| virtual void | doDeleteItem (MLssize_t index) |
| Delete single item at position index and set the corresponding ActDelete action. | |
| virtual void | doInsertItem (MLssize_t index, const T &item) |
| virtual void | doModifyItem (MLssize_t index, const T &item) |
| virtual void | doSelectItem (MLssize_t index) |
| virtual void | appendItem (const T &item) |
| void | addStateToTree (TreeNode *parent) const override |
| Attaches the object state as children of the given parent node. | |
| ML_SET_ADDSTATE_VERSION (1) | |
| Set addState version number. | |
| void | readStateFromTree (TreeNode *parent) override |
| Reads the object state from the children of the given parent node. | |
| Public Member Functions inherited from ml::ListTemplate< T > | |
| ListTemplate () | |
| Standard constructor, disables persistence. | |
| ListTemplate (bool persistence) | |
| Special constructor to explicitly enable/disable persistence. | |
| ListTemplate (const ListTemplate &other) | |
| 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. | |
| 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 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) |
List item persistence | |
List persistence is directly based on the persistence methods of the list item class. Hence, the following methods are mapped to the item class persistence methods. | |
| std::string | itemState (typename ListTemplate< T >::const_iterator it) const override |
| void | setItemState (typename ListTemplate< T >::iterator it, const std::string &state) override |
| Initialize the item object from the string state. | |
Additional Inherited Members | |
| Public Types inherited from ml::ListTemplate< T > | |
| 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... | |
| static const char *const | ActionClassNames [ActNumActions] |
| Action class name constants. | |
| Protected Member Functions inherited from ml::ListTemplate< T > | |
| 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. | |
Base object template list class for list item classes derived from BaseItem.
List class template (derived from ListTemplate) for list item classes derived from BaseItem. Persistence of the list is based on the corresponding methods of the list class. The list maintains a 'next id' feature to support unique item id's.
To implement an instance of BaseListTemplate with a given type T (where T must be a subclass of BaseItem), the following steps are necessary:
Definition at line 668 of file mlListBase.h.
|
inline |
Standard constructor, disables persistence.
Definition at line 676 of file mlListBase.h.
References ml::ListTemplate< T >::ListTemplate(), and T.
Referenced by addStateToTree(), BaseListTemplate(), and operator=().
|
inline |
Special constructor to explicitly enable/disable persistence.
Definition at line 679 of file mlListBase.h.
References ml::ListTemplate< T >::ListTemplate(), and T.
|
inline |
Definition at line 681 of file mlListBase.h.
References BaseListTemplate(), ml::ListTemplate< T >::ListTemplate(), and T.
|
overridevirtual |
Attaches the object state as children of the given parent node.
Attaches the object 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::Base.
Definition at line 936 of file mlListBase.h.
References ml::TreeNode::addChild(), addStateToTree(), BaseListTemplate(), ml::ListTemplate< T >::ListTemplate(), ML_ADDSTATE_SUPER, and ML_ADDSTATE_VERSION.
Referenced by addStateToTree().
|
virtual |
Appends an item to the list. Equivalent to list.doInsertItem(list->getSize(), item);
Definition at line 893 of file mlListBase.h.
References appendItem(), doInsertItem(), ml::ListTemplate< T >::ListTemplate(), and T.
Referenced by appendItem().
|
inlineoverridevirtual |
Clear complete list.
Reimplemented from ml::ListBase.
Definition at line 773 of file mlListBase.h.
References ml::ListTemplate< T >::ListTemplate(), and resetId().
Referenced by readStateFromTree().
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it does nothing at all. (also in ListTemplate<T>, because the items are not necessarily BaseItems there).
Here, the index is simply relayed to doDeleteItem.
Reimplemented from ml::ListBase.
Definition at line 727 of file mlListBase.h.
References doDeleteItem().
|
virtual |
Delete single item at position index and set the corresponding ActDelete action.
Definition at line 864 of file mlListBase.h.
References ml::ListBase::ActDelete, doDeleteItem(), ml::ListTemplate< T >::ListTemplate(), mlrange_cast(), and ml::ListBase::setAction().
Referenced by deleteItemAt(), and doDeleteItem().
|
virtual |
Insert item at position index, assign a new id value to the inserted item and set the corresponding ActInsert action.
Definition at line 877 of file mlListBase.h.
References ml::ListBase::ActInsert, doInsertItem(), ml::ListTemplate< T >::ListTemplate(), mlrange_cast(), newId(), ml::ListBase::setAction(), and T.
Referenced by appendItem(), doInsertItem(), and insertItemAt().
|
virtual |
Store item at position index and set the corresponding ActModify action. The id value of the modified item is left unchanged.
Definition at line 902 of file mlListBase.h.
References ml::ListBase::ActModify, doModifyItem(), ml::ListTemplate< T >::ListTemplate(), mlrange_cast(), ml::ListBase::setAction(), and T.
Referenced by doModifyItem(), and modifyItemAt().
|
virtual |
Select item at position index, or deselect if item == -1, and set the corresponding ActSelect action
Select item at position index, or deselect if index == -1, and set the corresponding ActSelect action
Definition at line 918 of file mlListBase.h.
References ml::ListBase::ActSelect, doSelectItem(), ml::ListTemplate< T >::ListTemplate(), mlrange_cast(), and ml::ListBase::setAction().
Referenced by doSelectItem(), and selectItemAt().
|
inlineoverridevirtual |
Same as getItemAt(MLssize_t index) for constant access.
Reimplemented from ml::ListBase.
Definition at line 698 of file mlListBase.h.
References mlrange_cast().
Referenced by ml::PCLMLTools::createPointCloudFromBaseList().
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it returns 0 in any case (also in ListTemplate<T>, because the items are not necessarily BaseItems there). Here, the item at the given index is returned. Note that no range checking is done for performance reasons.
Reimplemented from ml::ListBase.
Definition at line 693 of file mlListBase.h.
References mlrange_cast().
Referenced by ml::PCLMLTools::convertPointCloudToXMarkerList(), ml::ITKNodeContainerFromBasePointer(), ml::ITKPointSetFromBasePointer(), and ml::ITKPolylineFromBasePointer().
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it returns 0 in any case (also in ListTemplate<T>, because the items are not necessarily BaseItems there).
Reimplemented from ml::ListBase.
Definition at line 742 of file mlListBase.h.
Referenced by insertItemAt(), and modifyItemAt().
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it does nothing at all. (also in ListTemplate<T>, because the items are not necessarily BaseItems there).
Here, the item is inserted at the given index, as long as it is of type T.
Reimplemented from ml::ListBase.
Definition at line 706 of file mlListBase.h.
References doInsertItem(), getItemTypeId(), and T.
|
inlineoverrideprotectedvirtual |
Return a string representation of the item object.
Reimplemented from ml::ListTemplate< T >.
Definition at line 836 of file mlListBase.h.
| ml::BaseListTemplate< T >::ML_SET_ADDSTATE_VERSION | ( | 1 | ) |
Set addState version number.
Version History: 0 : adding size and items only 1 : also adding ListBase members (hasPersistence, currentItem);
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it does nothing at all. (also in ListTemplate<T>, because the items are not necessarily BaseItems there).
Here, the item is inserted at the given index, as long as it is of type T.
Reimplemented from ml::ListBase.
Definition at line 717 of file mlListBase.h.
References doModifyItem(), getItemTypeId(), and T.
|
inlinevirtual |
|
default |
explicitly create default assignment operator
References BaseListTemplate().
|
overridevirtual |
Reads the object state from the children of the given parent node.
Reimplemented from ml::Base.
Definition at line 961 of file mlListBase.h.
References ml::ListBase::ActNew, clearList(), ml::ListTemplate< T >::ListTemplate(), ML_READCHILD_OPTIONAL, ML_READSTATE_SUPER, readStateFromTree(), ml::ListBase::setAction(), T, and ml::TNE_UnsupportedClassVersion.
Referenced by readStateFromTree().
|
inlinevirtual |
Reset next id.
Definition at line 762 of file mlListBase.h.
References ml::ListTemplate< T >::ListTemplate(), and usedId().
Referenced by clearList().
|
inlineoverridevirtual |
This virtual function is reimplemented from ListBase, where it does nothing at all. (also in ListTemplate<T>, because the items are not necessarily BaseItems there).
Here, the index is simply relayed to doSelectItem.
Reimplemented from ml::ListBase.
Definition at line 735 of file mlListBase.h.
References doSelectItem().
|
inlineoverrideprotectedvirtual |
Initialize the item object from the string state.
Reimplemented from ml::ListTemplate< T >.
Definition at line 842 of file mlListBase.h.
References usedId().
|
inlinevirtual |
Notify list that id is used.
Definition at line 754 of file mlListBase.h.
Referenced by resetId(), and setItemState().