source: trunk/FACT++/dim_v19r19/dim/sllist.hxx@ 10480

Last change on this file since 10480 was 10480, checked in by tbretz, 14 years ago
New version V19r19 with some important bug fixes.
File size: 1.2 KB
Line 
1#ifndef __SLLHHDEFS
2#define __SLLHHDEFS
3
4class DllExp SLLItem {
5 friend class SLList ;
6 SLLItem *next;
7public:
8 SLLItem(){
9 next = 0;
10 };
11};
12
13class DllExp SLList {
14 SLLItem *head;
15 SLLItem *curr;
16public:
17 SLList (){
18 DISABLE_AST
19 head = new SLLItem();
20 curr = head;
21 ENABLE_AST
22 }
23 ~SLList()
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 }
40 SLLItem *getHead()
41 {
42 curr = head->next;
43 return( head->next );
44 }
45 SLLItem *getNext()
46 {
47 DISABLE_AST
48 if(!curr)
49 curr = head;
50 curr = curr->next;
51 ENABLE_AST
52 return( curr );
53 }
54 SLLItem *removeHead()
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
Note: See TracBrowser for help on using the repository browser.