RSeries astromech firmware
SetupEvent.h
Go to the documentation of this file.
1 #ifndef SetupEvent_h
2 #define SetupEvent_h
3 
4 #include "ReelTwo.h"
5 
16 {
17 public:
23  fNext(NULL)
24  {
25  if (*head() == NULL)
26  *head() = this;
27  if (*tail() != NULL)
28  (*tail())->fNext = this;
29  *tail() = this;
30  }
31 
35  static void ready()
36  {
37  for (SetupEvent* evt = *head(); evt != NULL; evt = evt->fNext)
38  {
39  evt->setup();
40  }
41  }
42 
46  virtual void setup() = 0;
47 
48 private:
49  SetupEvent* fNext;
50 
51  static SetupEvent** head()
52  {
53  static SetupEvent* sHead;
54  return &sHead;
55  }
56 
57  static SetupEvent** tail()
58  {
59  static SetupEvent* sTail;
60  return &sTail;
61  }
62 };
63 
64 #endif
ReelTwo.h
SetupEvent
Base class for all devices that require setup that cannot happen in the constructor....
Definition: SetupEvent.h:15
SetupEvent::SetupEvent
SetupEvent()
Default Constructor.
Definition: SetupEvent.h:22
SetupEvent::ready
static void ready()
Calls setup() for each created AnimatedEvent subclass.
Definition: SetupEvent.h:35
SetupEvent::setup
virtual void setup()=0
Subclasses must implement this function to perform any necessary setup that cannot happen in the cons...