FACT++  1.0
dllist.hxx
Go to the documentation of this file.
1 #ifndef __DLLHHDEFS
2 #define __DLLHHDEFS
3 
4 class DllExp DLLItem {
5  friend class DLList ;
8 public:
9  DLLItem(){
10  next = 0;
11  prev = 0;
12  };
13 };
14 
15 class DllExp DLList {
18 public:
19  DLList (){
20  DISABLE_AST
21  head = new DLLItem();
22  head->next = head;
23  head->prev = head;
24  curr = head;
25  ENABLE_AST
26  }
28  {
29  DISABLE_AST
30  delete head;
31  ENABLE_AST
32  }
33  void add(DLLItem *item)
34  {
35  DLLItem *prevp;
36  DISABLE_AST
37  item->next = head;
38  prevp = head->prev;
39  item->prev = prevp;
40  prevp->next = item;
41  head->prev = item;
42  ENABLE_AST
43  }
45  {
46  DISABLE_AST
47  if(head->next == head)
48  {
49  ENABLE_AST
50  return((DLLItem *)0);
51  }
52  curr = head->next;
53  ENABLE_AST
54  return( head->next );
55  }
57  {
58  DISABLE_AST
59  if(head->prev == head)
60  {
61  ENABLE_AST
62  return((DLLItem *)0);
63  }
64  curr = head->prev;
65  ENABLE_AST
66  return( head->prev );
67  }
69  {
70  DISABLE_AST
71  curr = curr->next;
72  if(curr == head)
73  {
74  ENABLE_AST
75  return((DLLItem *)0);
76  }
77  ENABLE_AST
78  return( curr );
79  }
81  {
82  DLLItem *item;
83  DISABLE_AST
84  item = head->next;
85  if(item == head)
86  {
87  ENABLE_AST
88  return((DLLItem *)0);
89  }
90  remove(item);
91  ENABLE_AST
92  return(item);
93  }
94  void remove(DLLItem *item)
95  {
96  DLLItem *prevp, *nextp;
97  DISABLE_AST
98  prevp = item->prev;
99  nextp = item->next;
100  prevp->next = item->next;
101  nextp->prev = prevp;
102  ENABLE_AST
103  }
104 };
105 #endif
DLLItem * getHead()
Definition: dllist.hxx:44
Definition: did.h:42
DLLItem * next
Definition: dllist.hxx:6
~DLList()
Definition: dllist.hxx:27
DLLItem * head
Definition: dllist.hxx:16
#define DllExp
Definition: dim_common.h:93
DLList()
Definition: dllist.hxx:19
struct item * next
Definition: did.h:43
DLLItem * getNext()
Definition: dllist.hxx:68
DLLItem * prev
Definition: dllist.hxx:7
DLLItem * curr
Definition: dllist.hxx:17
DLLItem * getLast()
Definition: dllist.hxx:56
DLLItem * removeHead()
Definition: dllist.hxx:80
void add(DLLItem *item)
Definition: dllist.hxx:33
DLLItem()
Definition: dllist.hxx:9