My Project
Loading...
Searching...
No Matches
CxxTest::List Struct Reference

#include <LinkedList.h>

Public Member Functions

void initialize ()
Link * head ()
const Link * head () const
Link * tail ()
const Link * tail () const
bool empty () const
unsigned size () const
Link * nth (unsigned n)
void activateAll ()
void leaveOnly (const Link &link)

Data Fields

Link * _head
Link * _tail

Detailed Description

Definition at line 11 of file LinkedList.h.

Member Function Documentation

◆ activateAll()

void List< T >::activateAll ( )

Definition at line 69 of file LinkedList.cpp.

70 {
71 for ( Link *l = _head; l != 0; l = l->justNext() )
72 l->setActive( true );
73 }
int l
Definition cfEzgcd.cc:100

◆ empty()

bool List< T >::empty ( ) const

Definition at line 48 of file LinkedList.cpp.

49 {
50 return (_head == 0);
51 }

◆ head() [1/2]

Link * List< T >::head ( )

Definition at line 16 of file LinkedList.cpp.

17 {
18 Link *l = _head;
19 while ( l && !l->active() )
20 l = l->next();
21 return l;
22 }

◆ head() [2/2]

const Link * List< T >::head ( ) const

Definition at line 24 of file LinkedList.cpp.

25 {
26 Link *l = _head;
27 while ( l && !l->active() )
28 l = l->next();
29 return l;
30 }

◆ initialize()

void List< T >::initialize ( )

Definition at line 11 of file LinkedList.cpp.

12 {
13 _head = _tail = 0;
14 }

◆ leaveOnly()

void List< T >::leaveOnly ( const Link & link)

Definition at line 75 of file LinkedList.cpp.

76 {
77 for ( Link *l = head(); l != 0; l = l->next() )
78 if ( l != &link )
79 l->setActive( false );
80 }
Link * head()

◆ nth()

Link * List< T >::nth ( unsigned n)

Definition at line 61 of file LinkedList.cpp.

62 {
63 Link *l = head();
64 while ( n -- )
65 l = l->next();
66 return l;
67 }

◆ size()

unsigned List< T >::size ( ) const

Definition at line 53 of file LinkedList.cpp.

54 {
55 unsigned count = 0;
56 for ( const Link *l = head(); l != 0; l = l->next() )
57 ++ count;
58 return count;
59 }
int status int void size_t count
Definition si_signals.h:69

◆ tail() [1/2]

Link * List< T >::tail ( )

Definition at line 32 of file LinkedList.cpp.

33 {
34 Link *l = _tail;
35 while ( l && !l->active() )
36 l = l->prev();
37 return l;
38 }

◆ tail() [2/2]

const Link * List< T >::tail ( ) const

Definition at line 40 of file LinkedList.cpp.

41 {
42 Link *l = _tail;
43 while ( l && !l->active() )
44 l = l->prev();
45 return l;
46 }

Field Documentation

◆ _head

Link* CxxTest::List::_head

Definition at line 13 of file LinkedList.h.

◆ _tail

Link* CxxTest::List::_tail

Definition at line 14 of file LinkedList.h.


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