Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | #pragma once |
| 7 | |
| 8 | #include <memory> |
| 9 | |
| 10 | class RobotStateInterface { |
| 11 | public: |
| 12 | virtual ~RobotStateInterface() = default; |
| 13 | virtual bool IsDisabled() const = 0; |
| 14 | virtual bool IsEnabled() const = 0; |
| 15 | virtual bool IsOperatorControl() const = 0; |
| 16 | virtual bool IsAutonomous() const = 0; |
| 17 | virtual bool IsTest() const = 0; |
| 18 | }; |
| 19 | |
| 20 | class RobotState { |
| 21 | private: |
| 22 | static std::shared_ptr<RobotStateInterface> impl; |
| 23 | |
| 24 | public: |
| 25 | static void SetImplementation(RobotStateInterface& i); |
| 26 | static void SetImplementation(std::shared_ptr<RobotStateInterface> i); |
| 27 | static bool IsDisabled(); |
| 28 | static bool IsEnabled(); |
| 29 | static bool IsOperatorControl(); |
| 30 | static bool IsAutonomous(); |
| 31 | static bool IsTest(); |
| 32 | }; |