CUBRID Engine  latest
freesllist.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #ifndef HL_FREESLLIST_H_
4 #define HL_FREESLLIST_H_
5 
6 #include <assert.h>
7 
17 class FreeSLList {
18 public:
19 
20  inline void clear (void) {
21  head.next = NULL;
22  }
23 
24  class Entry;
25 
27  inline Entry * get (void) {
28  const Entry * e = head.next;
29  if (e == NULL) {
30  return NULL;
31  }
32  head.next = e->next;
33  return const_cast<Entry *>(e);
34  }
35 
36  inline Entry * remove (void) {
37  const Entry * e = head.next;
38  if (e == NULL) {
39  return NULL;
40  }
41  head.next = e->next;
42  return const_cast<Entry *>(e);
43  }
44 
45  inline void insert (void * e) {
46  Entry * entry = reinterpret_cast<Entry *>(e);
47  entry->next = head.next;
48  head.next = entry;
49  }
50 
51  class Entry {
52  public:
53  Entry (void)
54  : next (NULL)
55  {}
57  private:
58  Entry (const Entry&);
59  Entry& operator=(const Entry&);
60  };
61 
62 private:
64 };
65 
66 
67 #endif
68 
69 
70 
71 
void insert(void *e)
Definition: freesllist.h:45
Entry head
Definition: freesllist.h:63
Entry & operator=(const Entry &)
#define NULL
Definition: freelistheap.h:34
void clear(void)
Definition: freesllist.h:20
A "memory neutral" singly-linked list,.
Definition: freesllist.h:17