WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Module.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef MODULE_H_
8 #define MODULE_H_
9 
10 #include "SensorBase.h"
11 #include "NetworkCommunication/LoadOut.h"
12 
13 #define kMaxModules (nLoadOut::kModuleType_Solenoid * kMaxModuleNumber + (kMaxModuleNumber - 1))
14 
15 class Module: public SensorBase
16 {
17 public:
18  nLoadOut::tModuleType GetType() {return m_moduleType;}
19  uint8_t GetNumber() {return m_moduleNumber;}
20  static Module *GetModule(nLoadOut::tModuleType type, uint8_t number);
21 
22 protected:
23  explicit Module(nLoadOut::tModuleType type, uint8_t number);
24  virtual ~Module();
25 
26  nLoadOut::tModuleType m_moduleType;
27  uint8_t m_moduleNumber;
28 
29 private:
30  static uint8_t ToIndex(nLoadOut::tModuleType type, uint8_t number);
31  static Module* m_modules[kMaxModules];
32 };
33 
34 #endif
uint8_t m_moduleNumber
The module index within the module type.
Definition: Module.h:27
virtual ~Module()
Definition: Module.cpp:30
nLoadOut::tModuleType m_moduleType
The type of module represented.
Definition: Module.h:26
Definition: SensorBase.h:20
Definition: Module.h:15
Module(nLoadOut::tModuleType type, uint8_t number)
Definition: Module.cpp:20
static Module * GetModule(nLoadOut::tModuleType type, uint8_t number)
Definition: Module.cpp:40