Scippy

SoPlex

Sequential object-oriented simPlex

IdList< T > Class Template Reference

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. 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 0, if elem is the last element. More...
 
T * prev (const T *elem) const
 returns predecessor of elem or 0, 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=0, T *plast=0, 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=0, const T *end=0) 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=0, T *plast=0, 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...
 

Detailed Description

template<class T>
class soplex::IdList< T >

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.

Definition at line 132 of file idlist.h.

Constructor & Destructor Documentation

◆ IdList()

IdList ( T *  pfirst = 0,
T *  plast = 0,
bool  pDestroyElements = false 
)
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.

Member Function Documentation

◆ append() [1/2]

void append ( T *  elem)

appends elem to end of list.

Definition at line 169 of file idlist.h.

Referenced by SVSetBase< BP >::create(), SVSetBase< BP >::operator=(), and SVSetBase< BP >::xtend().

◆ append() [2/2]

void append ( IdList< T > &  list)

appends list to end of list.

Definition at line 212 of file idlist.h.

◆ first()

◆ insert() [1/2]

void insert ( T *  elem,
T *  after 
)

inserts elem after after.

Definition at line 197 of file idlist.h.

◆ insert() [2/2]

void insert ( IdList< T > &  list,
T *  after 
)

inserts list after after.

Definition at line 232 of file idlist.h.

◆ isConsistent()

bool isConsistent ( ) const

consistency check.

Definition at line 334 of file idlist.h.

Referenced by SVSetBase< BP >::isConsistent().

◆ last()

◆ move()

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.

Referenced by SVSetBase< BP >::reMax().

◆ next()

T* next ( const T *  elem) const

returns successor of elem or 0, if elem is the last element.

Definition at line 152 of file idlist.h.

Referenced by SVSetBase< BP >::countUnusedMem(), SVSetBase< BP >::isConsistent(), SVSetBase< BP >::memPack(), and SVSetBase< BP >::memRemax().

◆ prepend() [1/2]

void prepend ( T *  elem)

prepends elem at beginnig of list.

Definition at line 183 of file idlist.h.

◆ prepend() [2/2]

void prepend ( IdList< T > &  list)

prepends list at beginnig of list.

Definition at line 222 of file idlist.h.

◆ prev()

T* prev ( const T *  elem) const

returns predecessor of elem or 0, if elem is the first element.

Definition at line 158 of file idlist.h.

◆ remove() [1/2]

void remove ( T *  elem)

removes elem from list.

Definition at line 260 of file idlist.h.

Referenced by SVSetBase< BP >::deleteVec(), and SVSetBase< BP >::xtend().

◆ remove() [2/2]

void remove ( IdList< T > &  list)

removes sublist list.

Definition at line 279 of file idlist.h.

◆ remove_next()

void remove_next ( T *  after)

removes element following after.

Definition at line 254 of file idlist.h.