blob: cb2820844cb0a14cc9f77d67703ee2909b7df051 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001#include "RobotState.h"
2
3#include "Base.h"
4
5std::shared_ptr<RobotStateInterface> RobotState::impl;
6
7void RobotState::SetImplementation(RobotStateInterface& i) {
8 impl = std::shared_ptr<RobotStateInterface>(
9 &i, NullDeleter<RobotStateInterface>());
10}
11
12void RobotState::SetImplementation(
13 std::shared_ptr<RobotStateInterface> i) {
14 impl = i;
15}
16
17bool RobotState::IsDisabled() {
18 if (impl != nullptr) {
19 return impl->IsDisabled();
20 }
21 return true;
22}
23
24bool RobotState::IsEnabled() {
25 if (impl != nullptr) {
26 return impl->IsEnabled();
27 }
28 return false;
29}
30
31bool RobotState::IsOperatorControl() {
32 if (impl != nullptr) {
33 return impl->IsOperatorControl();
34 }
35 return true;
36}
37
38bool RobotState::IsAutonomous() {
39 if (impl != nullptr) {
40 return impl->IsAutonomous();
41 }
42 return false;
43}
44
45bool RobotState::IsTest() {
46 if (impl != nullptr) {
47 return impl->IsTest();
48 }
49 return false;
50}