LinkedList Pile   version 0.0.1
LinkedList pile.
linkedlist.h
Go to the documentation of this file.
1 
10 #ifndef GUARD_LINKEDLIST_H_INCLUDE
11 #define GUARD_LINKEDLIST_H_INCLUDE
12 
13 #include <linkedlist/linkedlist-config.h>
14 
16 class LINKEDLIST_EXPORT LinkedList {
17  //
18  //
19  //
20  //
21  /* DEFINITIONS ----------------------------------------------------- */
22 
23 public:
24 
25  /* DEFINITIONS ===================================================== */
26  //
27  //
28  //
29  //
30  /* DATA ------------------------------------------------------------ */
31 
32 private:
33 
34  LinkedList * previous_;
35  LinkedList * next_;
37  /* DATA ============================================================ */
38  //
39  //
40  //
41  //
42  /* FUNCTIONS ------------------------------------------------------- */
43 
44 
45 public:
46 
48  explicit LinkedList ();
49 
51  virtual
52  ~LinkedList ();
53 
55  int
56  lNextCount ();
57 
59  LinkedList *
60  lExtract(
61  LinkedList * first_item);
62 
64  LinkedList *
66  return previous_;
67  }
68 
70  LinkedList *
71  lNext() {
72  return next_;
73  }
74 
75 public:
76 
78  static LinkedList *
79  lPushFront (
80  LinkedList * first_item,
81  LinkedList * new_item);
82 
84  static LinkedList *
85  lPushBack (
86  LinkedList * first_item,
87  LinkedList * new_item);
88 
90  static inline LinkedList *
92  LinkedList * first_item,
93  LinkedList * new_item) {
94  return lPushFront (first_item, new_item);
95  }
96 
98  static inline LinkedList *
100  LinkedList * first_item,
101  LinkedList * new_item) {
102  return lPushBack (first_item, new_item);
103  }
104 
106  static LinkedList *
107  lPopFront (
108  LinkedList * first_item);
109 
111  static LinkedList *
112  lPopBack (
113  LinkedList * first_item);
114 
116  static int
118  LinkedList * first_item) {
119  if (first_item == NULL) return 0;
120  else return first_item->lNextCount();
121  }
122 
124  static LinkedList *
125  lClear (
126  LinkedList * first_item);
127 
129  static LinkedList *
130  lItem (
131  LinkedList * first_item,
132  int index);
133 
135  static LinkedList *
137  LinkedList * first_item) {
138  return first_item;
139  }
140 
142  static LinkedList *
143  lLast (
144  LinkedList * first_item);
145 
146 
147 }; // class LinkedList
148 
149 #endif // GUARD_LINKEDLIST_H_INCLUDE
static LinkedList * append(LinkedList *first_item, LinkedList *new_item)
Inserts the item in the list as the first item.
Definition: linkedlist.h:99
static int lCount(LinkedList *first_item)
Finds out the number of elements in the list.
Definition: linkedlist.h:117
LinkedList * lNext()
Get next item.
Definition: linkedlist.h:71
static LinkedList * lFirst(LinkedList *first_item)
Get the first item.
Definition: linkedlist.h:136
A double-linked list.
Definition: linkedlist.h:16
static LinkedList * preppend(LinkedList *first_item, LinkedList *new_item)
Inserts the item in the list as the first item.
Definition: linkedlist.h:91
int lNextCount()
Finds out the number of elements that follow this one in the list.
Definition: linkedlist.cc:59
LinkedList * lPrevious()
Get previous item.
Definition: linkedlist.h:65