ESP8266
slist.h
1 #ifndef SLIST_H
2 #define SLIST_H
3 
4 template<typename T>
5 class SList {
6 public:
7  SList() : _next(0) { }
8 
9 protected:
10 
11  static void _add(T* self) {
12  T* tmp = _s_first;
13  _s_first = self;
14  self->_next = tmp;
15  }
16 
17  static void _remove(T* self) {
18  if (_s_first == self) {
19  _s_first = self->_next;
20  self->_next = 0;
21  return;
22  }
23 
24  for (T* prev = _s_first; prev->_next; prev = prev->_next) {
25  if (prev->_next == self) {
26  prev->_next = self->_next;
27  self->_next = 0;
28  return;
29  }
30  }
31  }
32 
33  static T* _s_first;
34  T* _next;
35 };
36 
37 
38 #endif //SLIST_H
static void _remove(T *self)
Definition: slist.h:17
SList()
Definition: slist.h:7
static T * _s_first
Definition: slist.h:33
static void _add(T *self)
Definition: slist.h:11
T * _next
Definition: slist.h:34
Definition: slist.h:5