00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _SLLIST_H_
00028 #define _SLLIST_H_
00029
00030 #include <assert.h>
00031
00038 namespace HL {
00039
00040 class SLList {
00041 public:
00042
00043 inline SLList (void) {
00044 clear();
00045 }
00046
00047 class Entry;
00048
00050 inline void clear (void) {
00051 head.next = NULL;
00052 }
00053
00055 inline Entry * get (void) {
00056 const Entry * e = head.next;
00057 if (e == NULL) {
00058 return NULL;
00059 }
00060 head.next = e->next;
00061 return (Entry *) e;
00062 }
00063
00064 private:
00065
00070 inline void remove (Entry *) {
00071 abort();
00072 }
00073
00074 public:
00075
00077 inline void insert (Entry * e) {
00078 e->next = head.next;
00079 head.next = e;
00080 }
00081
00083 class Entry {
00084 public:
00085 inline Entry (void)
00086 : next (NULL)
00087 {}
00088
00089
00090 public:
00091 Entry * next;
00092 };
00093
00094 private:
00095
00097 Entry head;
00098
00099 };
00100
00101 }
00102
00103 #endif