WPILib 2012
WPILibRoboticsLibraryforFRC
|
00001 /*----------------------------------------------------------------------------*/ 00002 /* Copyright (c) FIRST 2008. All Rights Reserved. */ 00003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ 00005 /*----------------------------------------------------------------------------*/ 00006 00007 #ifndef MODULE_H_ 00008 #define MODULE_H_ 00009 00010 #include "SensorBase.h" 00011 #include "NetworkCommunication/LoadOut.h" 00012 00013 #define kMaxModules (nLoadOut::kModuleType_Solenoid * kMaxModuleNumber + (kMaxModuleNumber - 1)) 00014 00015 class Module: public SensorBase 00016 { 00017 public: 00018 nLoadOut::tModuleType GetType() {return m_moduleType;} 00019 UINT8 GetNumber() {return m_moduleNumber;} 00020 static Module *GetModule(nLoadOut::tModuleType type, UINT8 number); 00021 00022 protected: 00023 explicit Module(nLoadOut::tModuleType type, UINT8 number); 00024 virtual ~Module(); 00025 00026 nLoadOut::tModuleType m_moduleType; 00027 UINT8 m_moduleNumber; 00028 00029 private: 00030 static UINT8 ToIndex(nLoadOut::tModuleType type, UINT8 number); 00031 static Module* m_modules[kMaxModules]; 00032 }; 00033 00034 #endif