Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 1 | #ifndef FRC971_WPILIB_NEWROBOTBASE_H_ |
| 2 | #define FRC971_WPILIB_NEWROBOTBASE_H_ |
| 3 | |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 4 | #ifdef WPILIB2015 |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 5 | #include "RobotBase.h" |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 6 | #else |
| 7 | #include "SampleRobot.h" |
| 8 | #endif |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 9 | |
| 10 | namespace frc971 { |
| 11 | namespace wpilib { |
| 12 | |
| 13 | class WPILibRobotBase { |
| 14 | public: |
| 15 | virtual void Run() = 0; |
| 16 | }; |
| 17 | |
| 18 | #define AOS_ROBOT_CLASS(_ClassName_) \ |
| 19 | START_ROBOT_CLASS(::frc971::wpilib::WPILibAdapterRobot<_ClassName_>) |
| 20 | |
| 21 | template <typename T> |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 22 | #ifdef WPILIB2015 |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 23 | class WPILibAdapterRobot : public RobotBase { |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 24 | #else |
| 25 | class WPILibAdapterRobot : public SampleRobot { |
| 26 | #endif |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 27 | public: |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 28 | #ifdef WPILIB2015 |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 29 | void StartCompetition() override { robot_.Run(); } |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 30 | #else |
| 31 | void RobotMain() override { robot_.Run(); } |
| 32 | #endif |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | T robot_; |
| 36 | }; |
| 37 | |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 38 | } // namespace wpilib |
| 39 | } // namespace frc971 |
Campbell Crowley | c0cfb13 | 2015-12-30 20:58:02 -0800 | [diff] [blame] | 40 | |
Brian Silverman | 4be7ffe | 2016-01-02 14:16:06 -0800 | [diff] [blame] | 41 | #endif // FRC971_WPILIB_NEWROBOTBASE_H_ |