Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2008-2017. 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 the root directory of */ |
| 5 | /* the project. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <memory> |
| 11 | |
| 12 | namespace frc { |
| 13 | |
| 14 | class RobotStateInterface { |
| 15 | public: |
| 16 | virtual ~RobotStateInterface() = default; |
| 17 | virtual bool IsDisabled() const = 0; |
| 18 | virtual bool IsEnabled() const = 0; |
| 19 | virtual bool IsOperatorControl() const = 0; |
| 20 | virtual bool IsAutonomous() const = 0; |
| 21 | virtual bool IsTest() const = 0; |
| 22 | }; |
| 23 | |
| 24 | class RobotState { |
| 25 | private: |
| 26 | static std::shared_ptr<RobotStateInterface> impl; |
| 27 | |
| 28 | public: |
| 29 | static void SetImplementation(RobotStateInterface& i); |
| 30 | static void SetImplementation(std::shared_ptr<RobotStateInterface> i); |
| 31 | static bool IsDisabled(); |
| 32 | static bool IsEnabled(); |
| 33 | static bool IsOperatorControl(); |
| 34 | static bool IsAutonomous(); |
| 35 | static bool IsTest(); |
| 36 | }; |
| 37 | |
| 38 | } // namespace frc |