Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
SLList Class Reference

#include <>>

Public Member Functions

 SLList (void)
 
SLNodefirst (void) const
 
SLNodelast (void) const
 
int count (void) const
 
bool isEmpty (void) const
 
void addFirst (SLNode *node)
 
void addLast (SLNode *node)
 
void removeFirst (void)
 
void removeLast (void)
 

Detailed Description

This class implements a single-link list data structure with nodes (SLNode) that must be extended to contain useful information.

Constructor & Destructor Documentation

◆ SLList()

SLList ( void  )
inline

Member Function Documentation

◆ addFirst()

void addFirst ( SLNode node)
inline

Add a node at the first position in the list.

Parameters
nodeNode to add.
Warning
It is an error to add the same nodes many times to one or to many lists.
It is an error to call this method on an empty list.

Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::addFirst(), and SLList::addLast().

◆ addLast()

void addLast ( SLNode node)

Add a node to the end of the list.

Parameters
nodeNode to add at the last position of the list. Remark that this method is really inefficient.bIts working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.
Warning
It is an error to add the same nodes many times to one or to many lists.

References SLList::addFirst(), SLNode::insertAfter(), and SLList::last().

Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::addLast().

◆ count()

int count ( void  ) const

Count the nodes in the list.

Returns
Count of nodes in the list.

References SLNode::next().

Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::count().

◆ first()

SLNode * first ( void  ) const
inline

Get te first node of the list.

Returns
First list node.
Warning
It is an error to call this method on an empty list.

◆ isEmpty()

◆ last()

SLNode * last ( void  ) const

Get te first node of the list. Remark that this method is really inefficient. Its working time is in O(n), n number of nodes in the list. Use it only with small list or revert to more powerful data structures.

Returns
Last list node.

References SLNode::next().

Referenced by SLList::addLast().

◆ removeFirst()

void removeFirst ( void  )
inline

◆ removeLast()

void removeLast ( void  )

Remove the last node of the list.

Warning
Remark that this method is really inefficient. If you have to perform this task too often, please revert to other data structure.

References SLNode::next(), and SLNode::removeNext().

Referenced by List< Pair< K, T >, CompareEquiv< AssocComparator< K, T, Comparator< K > > >, DefaultAlloc >::removeLast().


The documentation for this class was generated from the following files: