MeVisLab Toolbox Reference
|
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. | |
ListBase (const ListBase &other) | |
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. | |
ListBase * | deepCopy () const override |
Create a deep copy of the list. | |
Public Member Functions inherited from ml::Base | |
Base () | |
Constructor. | |
virtual | ~Base () |
Destructor. | |
bool | isOfAllowedType (const std::vector< const RuntimeType * > &types) const |
Check if this object's type is equal to or derived from one of the types given in the argument. | |
virtual bool | isRefCountedBase () const |
Returns if the instance is derived from RefCountedBase. | |
virtual std::string | detailString () const |
Return a string describing this object. | |
virtual bool | implementsPersistence (PersistenceInterface) const |
Override this method to declare which persistence interfaces are implemented by your derived class. | |
virtual std::string | persistentState () const |
Returns a string describing the object's internal state. | |
virtual void | setPersistentState (const std::string &state) |
Restores the object's internal state from a string that had been previously generated using persistentState() . | |
virtual void | writeTo (AbstractPersistenceOutputStream *) const |
Write the objects state to the data stream object. | |
virtual void | readFrom (AbstractPersistenceInputStream *, int) |
Read the objects state from the data stream object. | |
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. | |
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. | |
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. | |
void | addStateToTree (TreeNode *parent) const override |
Attaches the state as children of the given parent node. | |
ML_SET_ADDSTATE_VERSION (0) | |
Set addState version number. | |
void | readStateFromTree (TreeNode *parent) override |
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. | |
Additional Inherited Members | |
Public Types inherited from ml::Base | |
enum | PersistenceInterface { PersistenceByString , PersistenceByTreeNode , PersistenceByStream } |
This enum describes the different persistence interfaces available. More... | |
Base object class ListBase managing a number of BaseItem objects.
Basic list class with functionality to
Definition at line 62 of file mlListBase.h.
Constants to describe the type of action most recently performed.
Definition at line 187 of file mlListBase.h.
|
inline |
Constructor. Derived class should indicate whether persistence is implemented.
Definition at line 67 of file mlListBase.h.
Definition at line 75 of file mlListBase.h.
Attaches the state as children of the given parent node.
Reimplemented from ml::Base.
Reimplemented in ml::ListTemplate< T >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, and ml::ListTemplate< XMarker >.
Clear complete list.
Reimplemented in ml::ListTemplate< T >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, ml::ListTemplate< XMarker >, ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 125 of file mlListBase.h.
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< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, and ml::ListTemplate< XMarker >.
Definition at line 134 of file mlListBase.h.
|
inlineoverridevirtual |
Create a deep copy of the list.
Reimplemented from ml::Base.
Reimplemented in ml::ListTemplate< T >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, and ml::ListTemplate< XMarker >.
Definition at line 137 of file mlListBase.h.
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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 112 of file mlListBase.h.
Dispose a string allocated with newString()
Definition at line 253 of file mlListBase.h.
References ml::ParserBase::deleteString(), and mlrange_cast().
|
virtual |
Get actionClass, affected item id and index.
|
inlinevirtual |
Get actionClass of last action.
Definition at line 219 of file mlListBase.h.
Get id of item affected by last action.
Definition at line 223 of file mlListBase.h.
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 229 of file mlListBase.h.
Same as getItemAt(MLssize_t index) for constant access.
Reimplemented in ml::BaseListTemplate< T >, ml::BaseListTemplate< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 97 of file mlListBase.h.
Get index of currently selected item, or -1 if no item selected.
Definition at line 233 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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 94 of file mlListBase.h.
|
inlinevirtual |
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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 122 of file mlListBase.h.
Get number of list elements.
Implemented in ml::ListTemplate< T >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, and ml::ListTemplate< XMarker >.
Test if persistence is available and enabled.
Definition at line 152 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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 102 of file mlListBase.h.
Tests, if the last action has been an action that has modified the content of the list.
Definition at line 237 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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 107 of file mlListBase.h.
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 249 of file mlListBase.h.
References mlrange_cast(), and ml::ParserBase::newString().
Assignment operator, used in derived list classes.
Reads the object state from the children of the given parent node.
Reimplemented from ml::Base.
Reimplemented in ml::ListTemplate< T >, ml::ListTemplate< BaseContainerItem >, ml::ListTemplate< BaseItem >, ml::ListTemplate< KeyFrame >, ml::ListTemplate< Matrix3 >, ml::ListTemplate< Matrix4 >, ml::ListTemplate< vec3i >, ml::ListTemplate< vec4i >, ml::ListTemplate< vec6i >, ml::ListTemplate< Vector3 >, ml::ListTemplate< Vector4 >, ml::ListTemplate< Vector6 >, and ml::ListTemplate< XMarker >.
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< BaseContainerItem >, ml::BaseListTemplate< BaseItem >, and ml::BaseListTemplate< XMarker >.
Definition at line 117 of file mlListBase.h.
|
inlinevirtual |
Set actionClass for actions affecting the whole list.
Definition at line 212 of file mlListBase.h.
References mlrange_cast().
|
virtual |
Set actionClass, affected item id and index.
Enable/disable persistence functionality.
Definition at line 155 of file mlListBase.h.
References mlrange_cast().
|
friend |
Output persistent state to stream.
|
static |
Action class name constants.
Definition at line 206 of file mlListBase.h.