MeVisLabToolboxReference
|
Base object template list class for list item classes derived from BaseItem. More...
#include <mlListBase.h>
Public Member Functions | |
virtual BaseItem * | getItemAt (MLssize_t index) |
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). | |
virtual const BaseItem * | getConstItemAt (MLssize_t index) const |
Same as getItemAt(MLssize_t index) for constant access. | |
virtual void | insertItemAt (MLssize_t index, const BaseItem *item) |
This virtual function is reimplemented from ListBase, where it does nothing at all. | |
virtual void | modifyItemAt (MLssize_t index, const BaseItem *item) |
This virtual function is reimplemented from ListBase, where it does nothing at all. | |
virtual void | deleteItemAt (MLssize_t index) |
This virtual function is reimplemented from ListBase, where it does nothing at all. | |
virtual void | selectItemAt (MLssize_t index) |
This virtual function is reimplemented from ListBase, where it does nothing at all. | |
virtual const RuntimeType * | getItemTypeId () const |
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). | |
virtual void | clearList () |
Clear complete list. | |
Constructors | |
BaseListTemplate () | |
Standard constructor, disables persistence. | |
BaseListTemplate (bool persistance) | |
Special constructor to explicitly enable/disable persistence. | |
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) |
Insert item at position index, assign a new id value to the inserted item and set the corresponding ActInsert action. | |
virtual void | doModifyItem (MLssize_t index, const T &item) |
Store item at position index and set the corresponding ActModify action. | |
virtual void | doSelectItem (MLssize_t index) |
Select item at position index, or deselect if item == -1, and set the corresponding ActSelect action. | |
virtual void | appendItem (const T &item) |
Appends an item to the list. | |
virtual void | addStateToTree (TreeNode *parent) const |
Attaches the object state as children of the given parent node. | |
ML_SET_ADDSTATE_VERSION (1) | |
Set addState version number. | |
virtual void | readStateFromTree (TreeNode *parent) |
Reads the object state from the children of the given parent node. | |
Protected Member Functions | |
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. | |
virtual char * | getItemState (typename ListTemplate< T >::const_iterator it) const |
Return a string representation of the item object. | |
virtual void | setItemState (typename ListTemplate< T >::iterator it, const char *state) |
Initialize the item object from the string state. | |
virtual void | clearItemState (typename ListTemplate< T >::iterator it, char *state) const |
Dispose the string state, which has been previously obtained by getItemState() |
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 701 of file mlListBase.h.
ml::BaseListTemplate< T >::BaseListTemplate | ( | ) | [inline] |
Standard constructor, disables persistence.
Definition at line 709 of file mlListBase.h.
ml::BaseListTemplate< T >::BaseListTemplate | ( | bool | persistance | ) | [inline] |
Special constructor to explicitly enable/disable persistence.
Definition at line 712 of file mlListBase.h.
void ml::BaseListTemplate< T >::addStateToTree | ( | TreeNode * | parent | ) | const [virtual] |
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::ListTemplate< T >.
Definition at line 967 of file mlListBase.h.
References ml::TreeNode::addChild(), ML_ADDSTATE_SUPER, and ML_ADDSTATE_VERSION.
void ml::BaseListTemplate< T >::appendItem | ( | const T & | item | ) | [virtual] |
Appends an item to the list.
Equivalent to list.doInsertItem(list->getSize(), item);
Definition at line 929 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::clearItemState | ( | typename ListTemplate< T >::iterator | it, |
char * | state | ||
) | const [inline, protected, virtual] |
Dispose the string state, which has been previously obtained by getItemState()
Reimplemented from ml::ListTemplate< T >.
Definition at line 878 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::clearList | ( | ) | [inline, virtual] |
Clear complete list.
Reimplemented from ml::ListTemplate< T >.
Definition at line 801 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::deleteItemAt | ( | MLssize_t | index | ) | [inline, virtual] |
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 755 of file mlListBase.h.
void ml::BaseListTemplate< T >::doDeleteItem | ( | MLssize_t | index | ) | [virtual] |
Delete single item at position index and set the corresponding ActDelete action.
Definition at line 900 of file mlListBase.h.
void ml::BaseListTemplate< T >::doInsertItem | ( | MLssize_t | index, |
const T & | item | ||
) | [virtual] |
Insert item at position index, assign a new id value to the inserted item and set the corresponding ActInsert action.
Definition at line 913 of file mlListBase.h.
void ml::BaseListTemplate< T >::doModifyItem | ( | MLssize_t | index, |
const T & | item | ||
) | [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 938 of file mlListBase.h.
void ml::BaseListTemplate< T >::doSelectItem | ( | MLssize_t | index | ) | [virtual] |
Select item at position index, or deselect if item == -1, and set the corresponding ActSelect action.
Definition at line 954 of file mlListBase.h.
virtual const BaseItem* ml::BaseListTemplate< T >::getConstItemAt | ( | MLssize_t | index | ) | const [inline, virtual] |
Same as getItemAt(MLssize_t index) for constant access.
Reimplemented from ml::ListBase.
Definition at line 726 of file mlListBase.h.
virtual BaseItem* ml::BaseListTemplate< T >::getItemAt | ( | MLssize_t | index | ) | [inline, virtual] |
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 721 of file mlListBase.h.
Referenced by ml::ITKNodeContainerFromBasePointer(), ml::ITKPointSetFromBasePointer(), and ml::ITKPolylineFromBasePointer().
virtual char* ml::BaseListTemplate< T >::getItemState | ( | typename ListTemplate< T >::const_iterator | it | ) | const [inline, protected, virtual] |
Return a string representation of the item object.
The string is allocated on the heap and is later disposed by clearItemState().
Reimplemented from ml::ListTemplate< T >.
Definition at line 866 of file mlListBase.h.
virtual const RuntimeType* ml::BaseListTemplate< T >::getItemTypeId | ( | ) | const [inline, virtual] |
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 770 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::insertItemAt | ( | MLssize_t | index, |
const BaseItem * | item | ||
) | [inline, virtual] |
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 734 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);
virtual void ml::BaseListTemplate< T >::modifyItemAt | ( | MLssize_t | index, |
const BaseItem * | item | ||
) | [inline, virtual] |
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 745 of file mlListBase.h.
virtual MLssize_t ml::BaseListTemplate< T >::newId | ( | ) | [inline, virtual] |
Get new unused id.
Definition at line 779 of file mlListBase.h.
void ml::BaseListTemplate< T >::readStateFromTree | ( | TreeNode * | parent | ) | [virtual] |
Reads the object state from the children of the given parent node.
Reimplemented from ml::ListTemplate< T >.
Definition at line 992 of file mlListBase.h.
References ml::TreeNode::getVersion(), ml::TreeNode::hasChild(), ML_MAX, ML_OUT_OF_RANGE, ML_PRINT_ERROR, ML_READCHILD_OPTIONAL, ML_READSTATE_SUPER, ML_UINT32_MAX, ml::TreeNode::readChild(), ml::TreeNode::readContainerChild(), T, and ml::TNE_UnsupportedClassVersion.
virtual void ml::BaseListTemplate< T >::resetId | ( | ) | [inline, virtual] |
Reset next id.
Definition at line 790 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::selectItemAt | ( | MLssize_t | index | ) | [inline, virtual] |
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 763 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::setItemState | ( | typename ListTemplate< T >::iterator | it, |
const char * | state | ||
) | [inline, protected, virtual] |
Initialize the item object from the string state.
Reimplemented from ml::ListTemplate< T >.
Definition at line 870 of file mlListBase.h.
virtual void ml::BaseListTemplate< T >::usedId | ( | MLssize_t | id | ) | [inline, virtual] |
Notify list that id is used.
Definition at line 782 of file mlListBase.h.