gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
LinkList< TYPE > Class Template Reference

#include <LinkList.H>

Public Types

enum  direction { FWD, REV }
 

Public Member Functions

 LinkList (void)
 Initialiser This is for the first element - links to itself. More...
 
virtual ~LinkList (void)
 Small cleanup ... More...
 
void add (TYPE newElement)
 Adds as the current element ... Added to the next of the current lug. More...
 
TYPE change (TYPE changeElement)
 exchange lugs The current lug is replaced with this lug. More...
 
TYPE remove (void)
 remove the current lug from the LinkList The current lug is removed form the list and passed back to the caller. More...
 
TYPE current (void)
 return a pointer to the current lug More...
 
TYPE next (void)
 Return a pointer to the next lug and move on to that lug Increments according to dir (either forward or backwards). More...
 
TYPE prev (void)
 Return a pointer to the previous lug and move to that lug Increments against dir (either forward or backwards). More...
 
TYPE grab (int i)
 returns the i'th lug in the chain irrespective of direction More...
 
int getCount (void)
 
TYPE getEnd ()
 

Public Attributes

direction dir
 The current direction. More...
 

Private Attributes

Lug< TYPE > * lug
 The current Lug we are pointing to. More...
 
Lug< TYPE > * startLug
 The first Lug in the looped list. More...
 
long count
 The number in the list. More...
 

Friends

std::ostream & operator<< (std::ostream &o, LinkList *l)
 Runs the ostream operator on each element of the list. More...
 
std::ostream & operator<< (std::ostream &o, LinkList &l)
 Runs the ostream operator on each element of the list. More...
 

Detailed Description

template<class TYPE>
class LinkList< TYPE >

Examples:
BSTTest.C, and HeapTreeSort.C.

Definition at line 85 of file LinkList.H.

Member Enumeration Documentation

◆ direction

template<class TYPE>
enum LinkList::direction
Enumerator
FWD 
REV 

Definition at line 92 of file LinkList.H.

Constructor & Destructor Documentation

◆ LinkList()

template<class TYPE>
LinkList< TYPE >::LinkList ( void  )
inline

Initialiser This is for the first element - links to itself.

Definition at line 98 of file LinkList.H.

◆ ~LinkList()

template<class TYPE>
virtual LinkList< TYPE >::~LinkList ( void  )
inlinevirtual

Small cleanup ...

Definition at line 105 of file LinkList.H.

Member Function Documentation

◆ add()

template<class TYPE>
void LinkList< TYPE >::add ( TYPE  newElement)
inline

Adds as the current element ... Added to the next of the current lug.

Parameters
newElementThe element to add

Definition at line 119 of file LinkList.H.

Here is the caller graph for this function:

◆ change()

template<class TYPE>
TYPE LinkList< TYPE >::change ( TYPE  changeElement)
inline

exchange lugs The current lug is replaced with this lug.

Parameters
changeElementThe element to swap in
Returns
the element swapped out.

Definition at line 137 of file LinkList.H.

Here is the caller graph for this function:

◆ current()

template<class TYPE>
TYPE LinkList< TYPE >::current ( void  )
inline

return a pointer to the current lug

Returns
the current lug

Definition at line 212 of file LinkList.H.

Here is the caller graph for this function:

◆ getCount()

template<class TYPE>
int LinkList< TYPE >::getCount ( void  )
inline

< Returns the number of Lug s in the chain

Definition at line 278 of file LinkList.H.

Here is the caller graph for this function:

◆ getEnd()

template<class TYPE>
TYPE LinkList< TYPE >::getEnd ( )
inline

Method to get the last element in the list.

Returns
The lug at index i OR NULL if it doesn't exist

Definition at line 317 of file LinkList.H.

◆ grab()

template<class TYPE>
TYPE LinkList< TYPE >::grab ( int  i)
inline

returns the i'th lug in the chain irrespective of direction

Parameters
iThe lug to extract
Returns
The lug at index i OR NULL if it doesn't exist

Definition at line 259 of file LinkList.H.

Here is the caller graph for this function:

◆ next()

template<class TYPE>
TYPE LinkList< TYPE >::next ( void  )
inline

Return a pointer to the next lug and move on to that lug Increments according to dir (either forward or backwards).

Returns
The next lug in the chain

Definition at line 226 of file LinkList.H.

Here is the caller graph for this function:

◆ prev()

template<class TYPE>
TYPE LinkList< TYPE >::prev ( void  )
inline

Return a pointer to the previous lug and move to that lug Increments against dir (either forward or backwards).

Returns
The prev lug in the chain

Definition at line 244 of file LinkList.H.

Here is the caller graph for this function:

◆ remove()

template<class TYPE>
TYPE LinkList< TYPE >::remove ( void  )
inline

remove the current lug from the LinkList The current lug is removed form the list and passed back to the caller.

Returns
The removed lug.

Definition at line 153 of file LinkList.H.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<< [1/2]

template<class TYPE>
std::ostream& operator<< ( std::ostream &  o,
LinkList< TYPE > *  l 
)
friend

Runs the ostream operator on each element of the list.

Parameters
othe ostream
lA pointer to the linked list
Returns
The ostream

Definition at line 290 of file LinkList.H.

◆ operator<< [2/2]

template<class TYPE>
std::ostream& operator<< ( std::ostream &  o,
LinkList< TYPE > &  l 
)
friend

Runs the ostream operator on each element of the list.

Parameters
othe ostream
lThe linked list
Returns
The ostream

Definition at line 304 of file LinkList.H.

Member Data Documentation

◆ count

template<class TYPE>
long LinkList< TYPE >::count
private

The number in the list.

Definition at line 89 of file LinkList.H.

◆ dir

template<class TYPE>
direction LinkList< TYPE >::dir

The current direction.

Definition at line 93 of file LinkList.H.

◆ lug

template<class TYPE>
Lug<TYPE>* LinkList< TYPE >::lug
private

The current Lug we are pointing to.

Definition at line 87 of file LinkList.H.

◆ startLug

template<class TYPE>
Lug<TYPE>* LinkList< TYPE >::startLug
private

The first Lug in the looped list.

Definition at line 88 of file LinkList.H.


The documentation for this class was generated from the following file:
gtkIOStream: LinkList< TYPE > Class Template Reference
GTK+ IOStream  Beta