Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 2 | /* Copyright (c) FIRST 2008-2016. All Rights Reserved. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 6 | /*----------------------------------------------------------------------------*/ |
Brian Silverman | 1a67511 | 2016-02-20 20:42:49 -0500 | [diff] [blame^] | 7 | |
Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame] | 8 | #pragma once |
| 9 | |
| 10 | #include <memory> |
| 11 | |
| 12 | class RobotStateInterface { |
| 13 | public: |
| 14 | virtual ~RobotStateInterface() = default; |
| 15 | virtual bool IsDisabled() const = 0; |
| 16 | virtual bool IsEnabled() const = 0; |
| 17 | virtual bool IsOperatorControl() const = 0; |
| 18 | virtual bool IsAutonomous() const = 0; |
| 19 | virtual bool IsTest() const = 0; |
| 20 | }; |
| 21 | |
| 22 | class RobotState { |
| 23 | private: |
| 24 | static std::shared_ptr<RobotStateInterface> impl; |
| 25 | |
| 26 | public: |
| 27 | static void SetImplementation(RobotStateInterface& i); |
| 28 | static void SetImplementation(std::shared_ptr<RobotStateInterface> i); |
| 29 | static bool IsDisabled(); |
| 30 | static bool IsEnabled(); |
| 31 | static bool IsOperatorControl(); |
| 32 | static bool IsAutonomous(); |
| 33 | static bool IsTest(); |
| 34 | }; |