MeVisLabToolboxReference
|
Template module class ListContainerTemplate for a specific list class. More...
#include <mlListContainer.h>
Public Member Functions | |
ListContainerTemplate (int inputNum, int outputNum) | |
Constructor The values inputNum and outputNum specify the number of input and output image fields, resp. | |
virtual | ~ListContainerTemplate () |
Destructor. | |
virtual T * | getList () |
Get pointer to the active list object Use this pointer for list access after testing that it is != 0. | |
Public Attributes | |
T::itemType | _currentItem |
List item object used by insertItem() and modifyItem(). | |
Protected Member Functions | |
List object access | |
virtual bool | setActiveList (Base *basePtr) |
Set the active list pointer _listPtr to basePtr, provided that it is of the correct type. | |
virtual ListBase * | getInternalList () |
Return address of internal list object. | |
virtual MLssize_t | getId (MLssize_t index) |
Return the item id of the item index. | |
Handle item property fields | |
virtual void | updatePropertyFields () |
Update property fields from the current list item. | |
List modifications | |
virtual void | deleteItems (MLssize_t index, MLssize_t num) |
Remove num items, starting at item index. | |
virtual void | insertItem (MLssize_t index, bool fromCurrentItem) |
Insert an item at position index. | |
virtual bool | modifyItem (MLssize_t index, Field *field, bool fromCurrentItem) |
Modify item at position index. | |
virtual void | copyItemToTemplate (MLssize_t index) |
Copy values from item at position index to the template fields. | |
virtual void | copyTemplateToCurrent () |
Copy the values of the templates fields to _currentItem. | |
virtual void | initItem (MLssize_t index) |
Initialize the list item at position index. | |
Protected Attributes | |
T * | _listPtr |
Pointer to the active list object Use this pointer for list access after testing that it is != 0. |
Template module class ListContainerTemplate for a specific list class.
Class template for container modules for a specific list class. Contains a list object storing the internal list and implements the method to access this object.
To implement an instance of ListContainerTemplate with a given list type T (where T must be a subclass of BaseListTemplate), the following steps are necessary:
Definition at line 379 of file mlListContainer.h.
ml::ListContainerTemplate< T >::ListContainerTemplate | ( | int | inputNum, |
int | outputNum | ||
) |
Constructor The values inputNum and outputNum specify the number of input and output image fields, resp.
Constructor.
Definition at line 503 of file mlListContainer.h.
References ml::ListContainerBase::_fldInputList, ml::ListContainerBase::_fldOutputList, ml::ListContainerTemplate< T >::_listPtr, ml::ListContainerBase::_lockNotification, ml::FieldContainer::addBase(), ml::Module::getFieldContainer(), ml::RuntimeType::getName(), ML_CHECK_RUNTIME_TYPE, ML_TRACE_IN, and ml::BaseField::setBaseValueAndAddAllowedType().
virtual ml::ListContainerTemplate< T >::~ListContainerTemplate | ( | ) | [inline, virtual] |
Destructor.
Definition at line 389 of file mlListContainer.h.
void ml::ListContainerTemplate< T >::copyItemToTemplate | ( | MLssize_t | index | ) | [protected, virtual] |
Copy values from item at position index to the template fields.
Implements ml::ListContainerBase.
Reimplemented in ml::XMarkerListContainer.
Definition at line 696 of file mlListContainer.h.
References ML_TRACE_IN, and mlrange_cast().
void ml::ListContainerTemplate< T >::copyTemplateToCurrent | ( | ) | [protected, virtual] |
Copy the values of the templates fields to _currentItem.
Implements ml::ListContainerBase.
Reimplemented in ml::XMarkerListContainer.
Definition at line 709 of file mlListContainer.h.
References ML_TRACE_IN.
void ml::ListContainerTemplate< T >::deleteItems | ( | MLssize_t | index, |
MLssize_t | num | ||
) | [protected, virtual] |
Remove num items, starting at item index.
Implements ml::ListContainerBase.
Definition at line 595 of file mlListContainer.h.
References ML_CATCH_RETHROW, ML_TRACE_IN, and ML_TRY.
MLssize_t ml::ListContainerTemplate< T >::getId | ( | MLssize_t | index | ) | [protected, virtual] |
Return the item id of the item index.
Implements ml::ListContainerBase.
Definition at line 560 of file mlListContainer.h.
References ML_TRACE_IN, and mlrange_cast().
virtual ListBase* ml::ListContainerTemplate< T >::getInternalList | ( | ) | [inline, protected, virtual] |
Return address of internal list object.
Implements ml::ListContainerBase.
Definition at line 416 of file mlListContainer.h.
virtual T* ml::ListContainerTemplate< T >::getList | ( | ) | [inline, virtual] |
Get pointer to the active list object Use this pointer for list access after testing that it is != 0.
If the pointer is 0, an external object of a wrong type is connected to the input base field, in which case the module should be completely deactivated.
Definition at line 396 of file mlListContainer.h.
Referenced by ml::ITKNodeContainerFromBasePointer(), ml::ITKPointSetFromBasePointer(), and ml::ITKPolylineFromBasePointer().
void ml::ListContainerTemplate< T >::initItem | ( | MLssize_t | index | ) | [protected, virtual] |
Initialize the list item at position index.
This method is called by insertItem() if the fromCurrentItem argument is false. Moreover it is called when fldInit is touched.
This method is called by insertItem() if the fromCurrentItem argument is false. Moreover it is called when _fldClearItem is touched.
Implements ml::ListContainerBase.
Reimplemented in ml::XMarkerListContainer.
Definition at line 722 of file mlListContainer.h.
References ML_TRACE_IN, and mlrange_cast().
void ml::ListContainerTemplate< T >::insertItem | ( | MLssize_t | index, |
bool | fromCurrentItem | ||
) | [protected, virtual] |
Insert an item at position index.
If fromCurrentItem is true, the new item is initialized from _currentItem.
Implements ml::ListContainerBase.
Definition at line 619 of file mlListContainer.h.
References ML_CATCH_RETHROW, ML_TRACE_IN, ML_TRY, and mlrange_cast().
bool ml::ListContainerTemplate< T >::modifyItem | ( | MLssize_t | index, |
Field * | field, | ||
bool | fromCurrentItem | ||
) | [protected, virtual] |
Modify item at position index.
If fromCurrentItem is true, the item is copied from _currentItem, otherwise the item property corresponding to the property field field is modified. Return true if item has been modified.
Implements ml::ListContainerBase.
Reimplemented in ml::XMarkerListContainer.
Definition at line 657 of file mlListContainer.h.
References ML_CATCH_RETHROW, ML_TRACE_IN, ML_TRY, and mlrange_cast().
bool ml::ListContainerTemplate< T >::setActiveList | ( | Base * | basePtr | ) | [protected, virtual] |
Set the active list pointer _listPtr to basePtr, provided that it is of the correct type.
Otherwise the _listPtr is set to zero. Returns true if object is of correct type.
Implements ml::ListContainerBase.
Definition at line 539 of file mlListContainer.h.
References ML_BASE_IS_A, ML_TRACE_IN, and T.
void ml::ListContainerTemplate< T >::updatePropertyFields | ( | ) | [protected, virtual] |
Update property fields from the current list item.
Implements ml::ListContainerBase.
Reimplemented in ml::XMarkerListContainer.
Definition at line 572 of file mlListContainer.h.
References ml::BaseItem::getId(), ML_TRACE_IN, mlrange_cast(), and ml::BaseItem::name().
T::itemType ml::ListContainerTemplate< T >::_currentItem |
List item object used by insertItem() and modifyItem().
A derived editor module should use this variable to store a new or modified item and then call doInsertItem() or doModifyItem() with fromCurrentItem = true.
Definition at line 402 of file mlListContainer.h.
T* ml::ListContainerTemplate< T >::_listPtr [protected] |
Pointer to the active list object Use this pointer for list access after testing that it is != 0.
If the pointer is 0, an external object of a wrong type is connected to the input base field, in which case the module should be completely deactivated.
Definition at line 466 of file mlListContainer.h.
Referenced by ml::ListContainerTemplate< T >::ListContainerTemplate().