MeVisLabToolboxReference
|
Base object class ListBase managing a number of BaseItem objects. More...
#include <mlListBase.h>
Public Member Functions | |
ListBase (bool persistance) | |
Constructor. Derived class should indicate whether persistence is implemented. | |
Abstract list access | |
virtual size_t | getSize () const =0 |
Get number of list elements. | |
virtual BaseItem * | getItemAt (MLssize_t) |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually returns the item at the given index. | |
virtual const BaseItem * | getConstItemAt (MLssize_t) const |
Same as getItemAt(MLssize_t index) for constant access. | |
virtual void | insertItemAt (MLssize_t, const BaseItem *) |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually inserts the item at the given index. | |
virtual void | modifyItemAt (MLssize_t, const BaseItem *) |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually modifies the item at the given index. | |
virtual void | deleteItemAt (MLssize_t) |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually deletes the item at the given index. | |
virtual void | selectItemAt (MLssize_t) |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually selects the item at the given index. | |
virtual const RuntimeType * | getItemTypeId () const |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually returns the item class' type id. | |
virtual void | clearList () |
Clear complete list. | |
virtual ListBase * | clone () const |
Create a copy of (*this) using the ML runtime system and the '='-operator. | |
virtual ListBase * | deepCopy () const |
Create a deep copy of the list. | |
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() | |
ListBase & | operator= (const ListBase &list) |
Assignment operator, used in derived list classes. | |
Persistence enable/disable and stream output | |
If persistence is enabled, the get/setPersistantState() methods of the derived ListTemplate classes iterate through all list items to get/set their state. If no persistence is implemented for the item class, persistence should be disabled to increase performance. | |
virtual bool | hasPersistance () const |
Test if persistence is available and enabled. | |
virtual void | setPersistance (bool persistance) |
Enable/disable persistence functionality. | |
virtual void | addStateToTree (TreeNode *parent) const |
Attaches the 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. | |
MLBASEEXPORT friend std::ostream & | operator<< (std::ostream &s, const ListBase &list) |
Output persistent state to stream. | |
Last action performed on list | |
When different modules share a common list object, they can use a description of the last action performed on the list to synchronize themselves. Such a description consists of an action class, the id and the list index of the affected list item. The id can store a constant value uniquely identifying an item within a list. Some actions do not refer to a single list item, in which case id and index should be set to -1. In addition, the list maintains the index of the currently selected item, which can be set by setAction(ActSelect, ...) and which is updated when other operations are performed on the list. | |
enum | ActionClass { ActNone = 0, ActUnknown, ActNew, ActSelect, ActModify, ActDelete, ActInsert, ActInsertOvw, ActNumActions } |
Constants to describe the type of action most recently performed. More... | |
static const char *const | ActionClassNames [ActNumActions] |
Action class name constants. | |
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 |
Get index of item affected by last action. | |
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. |
Base object class ListBase managing a number of BaseItem objects.
Basic list class with functionality to
Definition at line 70 of file mlListBase.h.
Constants to describe the type of action most recently performed.
Definition at line 188 of file mlListBase.h.
ml::ListBase::ListBase | ( | bool | persistance | ) | [inline] |
Constructor. Derived class should indicate whether persistence is implemented.
Definition at line 75 of file mlListBase.h.
virtual void ml::ListBase::addStateToTree | ( | TreeNode * | parent | ) | const [virtual] |
Attaches the state as children of the given parent node.
Reimplemented from ml::Base.
Reimplemented in ml::ListTemplate< T >, ml::BaseListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
virtual void ml::ListBase::clearList | ( | ) | [inline, virtual] |
Clear complete list.
Reimplemented in ml::ListTemplate< T >, ml::BaseListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 126 of file mlListBase.h.
virtual ListBase* ml::ListBase::clone | ( | void | ) | const [inline, virtual] |
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. This function should not be called since it is overwritten by the clone()-method of ListTemplate<T>
Reimplemented in ml::ListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, and ml::ListTemplate< vec4i >.
Definition at line 135 of file mlListBase.h.
virtual ListBase* ml::ListBase::deepCopy | ( | ) | const [inline, virtual] |
Create a deep copy of the list.
Reimplemented from ml::Base.
Reimplemented in ml::BaseList, ml::ListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, and ml::ListTemplate< vec4i >.
Definition at line 138 of file mlListBase.h.
virtual void ml::ListBase::deleteItemAt | ( | MLssize_t | ) | [inline, virtual] |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually deletes the item at the given index.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, nothing is done.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 113 of file mlListBase.h.
void ml::ListBase::deleteString | ( | char * | str | ) | const [inline, protected] |
Dispose a string allocated with newString()
Definition at line 254 of file mlListBase.h.
virtual void ml::ListBase::getAction | ( | ActionClass & | actionClass, |
MLssize_t & | id, | ||
MLssize_t & | index | ||
) | const [virtual] |
Get actionClass, affected item id and index.
virtual ActionClass ml::ListBase::getActionClass | ( | ) | const [inline, virtual] |
Get actionClass of last action.
Definition at line 220 of file mlListBase.h.
virtual MLssize_t ml::ListBase::getActionId | ( | ) | const [inline, virtual] |
Get id of item affected by last action.
Definition at line 224 of file mlListBase.h.
virtual MLssize_t ml::ListBase::getActionIndex | ( | ) | const [inline, virtual] |
Get index of item affected by last action.
If last action was ActDelete, index refers to position before deleted item, or equals -1 if first item was deleted.
Definition at line 230 of file mlListBase.h.
Same as getItemAt(MLssize_t index) for constant access.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 98 of file mlListBase.h.
virtual MLssize_t ml::ListBase::getCurrentIndex | ( | ) | const [inline, virtual] |
Get index of currently selected item, or -1 if no item selected.
Definition at line 234 of file mlListBase.h.
This virtual function is reimplemented in BaseListTemplate<T>, where it actually returns the item at the given index.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, 0 is to be returned. Thus, this function can also be used to determine whether the list is actually derived from BaseListTemplate<T> (the runtime system can't help you with that because of the template).
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 95 of file mlListBase.h.
virtual const RuntimeType* ml::ListBase::getItemTypeId | ( | ) | const [inline, virtual] |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually returns the item class' type id.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, NULL is returned.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 123 of file mlListBase.h.
virtual size_t ml::ListBase::getSize | ( | ) | const [pure virtual] |
Get number of list elements.
Implemented in ml::ListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, and ml::ListTemplate< vec4i >.
virtual bool ml::ListBase::hasPersistance | ( | ) | const [inline, virtual] |
Test if persistence is available and enabled.
Definition at line 153 of file mlListBase.h.
This virtual function is reimplemented in BaseListTemplate<T>, where it actually inserts the item at the given index.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, nothing is done.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 103 of file mlListBase.h.
virtual bool ml::ListBase::isModified | ( | ) | const [inline, virtual] |
Tests, if the last action has been an action that has modified the content of the list.
Definition at line 238 of file mlListBase.h.
ml::ListBase::ML_SET_ADDSTATE_VERSION | ( | 0 | ) |
Set addState version number.
This virtual function is reimplemented in BaseListTemplate<T>, where it actually modifies the item at the given index.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, nothing is done.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 108 of file mlListBase.h.
char* ml::ListBase::newString | ( | const std::string & | str | ) | const [inline, 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.
Definition at line 250 of file mlListBase.h.
Assignment operator, used in derived list classes.
virtual void ml::ListBase::readStateFromTree | ( | TreeNode * | parent | ) | [virtual] |
Reads the object state from the children of the given parent node.
Reimplemented from ml::Base.
Reimplemented in ml::ListTemplate< T >, ml::BaseListTemplate< T >, ml::ListTemplate< Vector6 >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< vec6i >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< XMarker >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
virtual void ml::ListBase::selectItemAt | ( | MLssize_t | ) | [inline, virtual] |
This virtual function is reimplemented in BaseListTemplate<T>, where it actually selects the item at the given index.
For list types that are NOT derived from BaseListTemplate<T>, and thus do not have BaseItem's as list items, nothing is done.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseItem >, ml::BaseListTemplate< BaseContainerItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 118 of file mlListBase.h.
virtual void ml::ListBase::setAction | ( | ActionClass | actionClass | ) | [inline, virtual] |
Set actionClass for actions affecting the whole list.
Definition at line 213 of file mlListBase.h.
References setAction().
Referenced by setAction().
virtual void ml::ListBase::setAction | ( | ActionClass | actionClass, |
MLssize_t | id, | ||
MLssize_t | index | ||
) | [virtual] |
Set actionClass, affected item id and index.
virtual void ml::ListBase::setPersistance | ( | bool | persistance | ) | [inline, virtual] |
Enable/disable persistence functionality.
Definition at line 156 of file mlListBase.h.
MLBASEEXPORT friend std::ostream& operator<< | ( | std::ostream & | s, |
const ListBase & | list | ||
) | [friend] |
Output persistent state to stream.
const char* const ml::ListBase::ActionClassNames[ActNumActions] [static] |
Action class name constants.
Definition at line 207 of file mlListBase.h.