blob: 50ef970ab3c0a0537e21f70d5d9c828791c87d16 [file] [log] [blame]
Campbell Crowleyc0cfb132015-12-30 20:58:02 -08001#ifndef FRC971_WPILIB_NEWROBOTBASE_H_
2#define FRC971_WPILIB_NEWROBOTBASE_H_
3
Brian Silverman4be7ffe2016-01-02 14:16:06 -08004#ifdef WPILIB2015
Campbell Crowleyc0cfb132015-12-30 20:58:02 -08005#include "RobotBase.h"
Brian Silverman4be7ffe2016-01-02 14:16:06 -08006#else
7#include "SampleRobot.h"
8#endif
Campbell Crowleyc0cfb132015-12-30 20:58:02 -08009
10namespace frc971 {
11namespace wpilib {
12
13class WPILibRobotBase {
14public:
15 virtual void Run() = 0;
16};
17
18#define AOS_ROBOT_CLASS(_ClassName_) \
19 START_ROBOT_CLASS(::frc971::wpilib::WPILibAdapterRobot<_ClassName_>)
20
21template <typename T>
Brian Silverman4be7ffe2016-01-02 14:16:06 -080022#ifdef WPILIB2015
Campbell Crowleyc0cfb132015-12-30 20:58:02 -080023class WPILibAdapterRobot : public RobotBase {
Brian Silverman4be7ffe2016-01-02 14:16:06 -080024#else
25class WPILibAdapterRobot : public SampleRobot {
26#endif
Campbell Crowleyc0cfb132015-12-30 20:58:02 -080027 public:
Brian Silverman4be7ffe2016-01-02 14:16:06 -080028#ifdef WPILIB2015
Campbell Crowleyc0cfb132015-12-30 20:58:02 -080029 void StartCompetition() override { robot_.Run(); }
Brian Silverman4be7ffe2016-01-02 14:16:06 -080030#else
31 void RobotMain() override { robot_.Run(); }
32#endif
Campbell Crowleyc0cfb132015-12-30 20:58:02 -080033
34 private:
35 T robot_;
36};
37
Brian Silverman4be7ffe2016-01-02 14:16:06 -080038} // namespace wpilib
39} // namespace frc971
Campbell Crowleyc0cfb132015-12-30 20:58:02 -080040
Brian Silverman4be7ffe2016-01-02 14:16:06 -080041#endif // FRC971_WPILIB_NEWROBOTBASE_H_