Generic Real linked list. More...
#include <idlist.h>
Public Member Functions | |
Access | |
| T * | first () const |
| returns first element in list. More... | |
| T * | last () const |
| returns last element in list. More... | |
| T * | next (const T *elem) const |
returns successor of elem or nullptr, if elem is the last element. More... | |
| T * | prev (const T *elem) const |
returns predecessor of elem or nullptr, if elem is the first element. More... | |
Extension | |
| void | append (T *elem) |
appends elem to end of list. More... | |
| void | prepend (T *elem) |
prepends elem at beginnig of list. More... | |
| void | insert (T *elem, T *after) |
inserts elem after after. More... | |
| void | append (IdList< T > &list) |
appends list to end of list. More... | |
| void | prepend (IdList< T > &list) |
prepends list at beginnig of list. More... | |
| void | insert (IdList< T > &list, T *after) |
inserts list after after. More... | |
Removal | |
| void | remove_next (T *after) |
removes element following after. More... | |
| void | remove (T *elem) |
removes elem from list. More... | |
| void | remove (IdList< T > &list) |
removes sublist list. More... | |
Miscellaneous | |
| void | move (ptrdiff_t delta) |
| adjusts list pointers to a new memory address. More... | |
| bool | isConsistent () const |
| consistency check. More... | |
Constructors / Destructors | |
| IdList (T *pfirst=nullptr, T *plast=nullptr, bool pDestroyElements=false) | |
| default constructor. More... | |
Public Member Functions inherited from IsList< T > | |
| void | append (T *elem) |
appends elem to IsList. More... | |
| void | prepend (T *elem) |
prepends elem to IsList. More... | |
| void | insert (T *elem, T *after) |
inserts elem to IsList after its element after. More... | |
| void | append (IsList< T > &list) |
appends all elements of list to IsList. More... | |
| void | prepend (IsList< T > &list) |
prepends all elements of list to IsList. More... | |
| void | insert (IsList< T > &list, T *after) |
inserts all elements of list after element after of an IsList. More... | |
| void | remove_next (T *after) |
removes the successor of after from an IsList. More... | |
| void | remove (const T *elem) |
removes element elem from an IsList. More... | |
| void | remove (IsList< T > &list) |
removes all elements of list from an IsList. More... | |
| void | clear (bool pDestroyElements=false) |
| removes all elements from an IsList. More... | |
| T * | first () const |
| returns the IsList's first element. More... | |
| T * | last () const |
| returns the IsList's last element. More... | |
| T * | next (const T *elem) const |
returns successor of elem in an IsList. More... | |
| int | length () const |
| returns the number of elements in IsList. More... | |
| int | find (const T *elem) const |
returns the position of element elem within IsList. More... | |
| IsList< T > | sublist (const T *start=nullptr, const T *end=nullptr) const |
| constructs sublist of an IsList. More... | |
| void | move (ptrdiff_t delta) |
| adjusts list pointers to a new memory address. More... | |
| bool | isConsistent () const |
| consistency check. More... | |
| IsList (T *pfirst=nullptr, T *plast=nullptr, bool pDestroyElements=false) | |
| default constructor. More... | |
| IsList (const IsList< T > &)=delete | |
| Assignment operator and copy constructor should be deleted to avoid memory problems. More... | |
| IsList< T > & | operator= (const IsList< T > &old)=delete |
| ~IsList () | |
| destructor More... | |
Additional Inherited Members | |
Public Types inherited from IsList< T > | |
| typedef IsElement< T > | Element |
Protected Attributes inherited from IsList< T > | |
| T * | the_first |
| the first element in the IsList. More... | |
| T * | the_last |
| the last element in the IsList. More... | |
| bool | destroyElements |
| should the destructor be called for each element when the list is destroyed? More... | |
Generic Real linked list.
Class IdList implements an intrusive Real linked list as a template class. As such, the list elements must provide the links themselfs. For conveniance, we also provide class IdElement that adds both links to an arbitrary class as template parameter.
|
explicit |
default constructor.
The default constructor may also be used to construct a sublist, by providing a first and a last element. Element last must be a successor of first.
Definition at line 365 of file idlist.h.
References IdList< T >::isConsistent().
| void append | ( | IdList< T > & | list | ) |
appends list to end of list.
Definition at line 212 of file idlist.h.
References IdList< T >::append(), IdList< T >::first(), IdList< T >::last(), and IsList< T >::the_last.
| void append | ( | T * | elem | ) |
appends elem to end of list.
Definition at line 169 of file idlist.h.
References IdList< T >::last(), IsList< T >::the_first, and IsList< T >::the_last.
Referenced by IdList< T >::append(), and IdList< T >::insert().
| T * first | ( | ) | const |
returns first element in list.
Definition at line 140 of file idlist.h.
References IsList< T >::the_first.
Referenced by IdList< T >::append(), IdList< T >::insert(), IdList< T >::isConsistent(), IdList< T >::move(), IdList< T >::prepend(), IdList< T >::prev(), and IdList< T >::remove().
| void insert | ( | IdList< T > & | list, |
| T * | after | ||
| ) |
inserts list after after.
Definition at line 232 of file idlist.h.
References IsList< T >::find(), IdList< T >::first(), IdList< T >::last(), and IsList< T >::the_last.
| void insert | ( | T * | elem, |
| T * | after | ||
| ) |
inserts elem after after.
Definition at line 197 of file idlist.h.
References IdList< T >::append(), IsList< T >::find(), and IdList< T >::last().
| bool isConsistent | ( | ) | const |
consistency check.
Definition at line 334 of file idlist.h.
References IdList< T >::first(), IsList< T >::isConsistent(), IdList< T >::last(), IdList< T >::next(), and SPX_MSG_INCONSISTENT.
Referenced by IdList< T >::IdList().
| T * last | ( | ) | const |
returns last element in list.
Definition at line 146 of file idlist.h.
References IsList< T >::the_last.
Referenced by IdList< T >::append(), IdList< T >::insert(), IdList< T >::isConsistent(), IdList< T >::move(), IdList< T >::next(), IdList< T >::prepend(), and IdList< T >::remove().
| void move | ( | ptrdiff_t | delta | ) |
adjusts list pointers to a new memory address.
When all elements have been moved in memory (e.g. because of reallocation) with a fixed offset delta, the list will be reset to the new adresses.
Definition at line 319 of file idlist.h.
References IdList< T >::first(), IdList< T >::last(), IsList< T >::move(), IdList< T >::prev(), and IsList< T >::the_first.
| T * next | ( | const T * | elem | ) | const |
returns successor of elem or nullptr, if elem is the last element.
Definition at line 152 of file idlist.h.
References IdList< T >::last().
Referenced by IdList< T >::isConsistent(), IdList< T >::remove(), and IdList< T >::remove_next().
| void prepend | ( | IdList< T > & | list | ) |
prepends list at beginnig of list.
Definition at line 222 of file idlist.h.
References IdList< T >::first(), IdList< T >::last(), IdList< T >::prepend(), and IsList< T >::the_first.
| void prepend | ( | T * | elem | ) |
prepends elem at beginnig of list.
Definition at line 183 of file idlist.h.
References IdList< T >::first(), IsList< T >::the_first, and IsList< T >::the_last.
Referenced by IdList< T >::prepend().
| T * prev | ( | const T * | elem | ) | const |
returns predecessor of elem or nullptr, if elem is the first element.
Definition at line 158 of file idlist.h.
References IdList< T >::first().
Referenced by IdList< T >::move().
| void remove | ( | IdList< T > & | list | ) |
removes sublist list.
Definition at line 279 of file idlist.h.
References IsList< T >::find(), IdList< T >::first(), IdList< T >::last(), IsList< T >::the_first, and IsList< T >::the_last.
| void remove | ( | T * | elem | ) |
removes elem from list.
Definition at line 260 of file idlist.h.
References IdList< T >::first(), IdList< T >::last(), IdList< T >::next(), IsList< T >::the_first, and IsList< T >::the_last.
Referenced by IdList< T >::remove_next().
| void remove_next | ( | T * | after | ) |
removes element following after.
Definition at line 254 of file idlist.h.
References IdList< T >::next(), and IdList< T >::remove().