FACT++  1.0
sllist.hxx
Go to the documentation of this file.
1 #ifndef __SLLHHDEFS
2 #define __SLLHHDEFS
3 
4 class DllExp SLLItem {
5  friend class SLList ;
7 public:
8  SLLItem(){
9  next = 0;
10  };
11 };
12 
13 class DllExp SLList {
16 public:
17  SLList (){
18  DISABLE_AST
19  head = new SLLItem();
20  curr = head;
21  ENABLE_AST
22  }
24  {
25  DISABLE_AST
26  delete head;
27  ENABLE_AST
28  }
29  void add(SLLItem *itemptr)
30  {
31  DISABLE_AST
32  SLLItem *ptr = head;
33  while(ptr->next)
34  {
35  ptr = ptr->next;
36  }
37  ptr->next = itemptr;
38  ENABLE_AST
39  }
41  {
42  curr = head->next;
43  return( head->next );
44  }
46  {
47  DISABLE_AST
48  if(!curr)
49  curr = head;
50  curr = curr->next;
51  ENABLE_AST
52  return( curr );
53  }
55  {
56  SLLItem *ptr;
57 
58  DISABLE_AST
59  ptr = head->next;
60  if(ptr)
61  {
62  head->next = ptr->next;
63  curr = head->next;
64  }
65  ENABLE_AST
66  return( ptr);
67  }
68  void remove(SLLItem *itemptr)
69  {
70  SLLItem *ptr = head, *prev;
71  DISABLE_AST
72  while(ptr->next)
73  {
74  prev = ptr;
75  ptr = ptr->next;
76  if( itemptr == ptr )
77  {
78  prev->next = ptr->next;
79  }
80  }
81  ENABLE_AST
82  }
83 };
84 #endif
~SLList()
Definition: sllist.hxx:23
SLLItem * removeHead()
Definition: sllist.hxx:54
#define DllExp
Definition: dim_common.h:93
void add(SLLItem *itemptr)
Definition: sllist.hxx:29
SLLItem * head
Definition: sllist.hxx:14
SLLItem()
Definition: sllist.hxx:8
SLLItem * getHead()
Definition: sllist.hxx:40
SLLItem * next
Definition: sllist.hxx:6
SLLItem * curr
Definition: sllist.hxx:15
SLLItem * getNext()
Definition: sllist.hxx:45
SLList()
Definition: sllist.hxx:17