LRT13  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Component.h
1 #ifndef COMPONENT_H_
2 #define COMPONENT_H_
3 
4 #include <WPILib.h>
5 
6 #include <list>
7 #include <string>
8 
9 #include "../ComponentData/ComponentData.h"
10 
11 class ComponentManager;
12 
17 class Component
18 {
19 public:
20  struct ComponentWithData
21  {
22  bool RequiresEnabledState;
23  const static int NO_DS_DISABLE_DIO = -1;
24  int DS_DIOToDisableComponent;
25  Component *component;
26  };
27 
31  Component(std::string name, int dio, bool requiresEnabledState);
32 
36  virtual ~Component();
37 
41  virtual void enabledPeriodic() = 0;
42 
46  virtual void disabledPeriodic() = 0;
47 
51  virtual void onEnable() = 0;
52 
56  virtual void onDisable() = 0;
57 
61  void Enable();
62 
66  void Disable();
67 
71  bool IsEnabled();
72 
76  bool EnableRequired();
77 
81  int GetDIO();
82 
86  std::string GetName();
87 
88 protected:
89  data::ComponentData * const m_componentData;
90 private:
91  std::string m_name;
92  bool m_enabled;
93 
94  bool m_requiresEnabled;
95 
96  int m_DIO;
97 };
98 
99 #endif //COMPONENT_H_