blob: 29afb242564d72380ea02c3ecbb349af125423b0 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
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
15class Module: public SensorBase
16{
17public:
18 nLoadOut::tModuleType GetType() {return m_moduleType;}
19 UINT8 GetNumber() {return m_moduleNumber;}
20 static Module *GetModule(nLoadOut::tModuleType type, UINT8 number);
21
22protected:
23 explicit Module(nLoadOut::tModuleType type, UINT8 number);
24 virtual ~Module();
25
26 nLoadOut::tModuleType m_moduleType; ///< The type of module represented.
27 UINT8 m_moduleNumber; ///< The module index within the module type.
28
29private:
30 static UINT8 ToIndex(nLoadOut::tModuleType type, UINT8 number);
31 static Module* m_modules[kMaxModules];
32};
33
34#endif