1 // 2 // Copyright (C) 2009 Nick Gasson 3 // 4 // This program is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program. If not, see <http://www.gnu.org/licenses/>. 16 // 17 18 #ifndef INC_ICONTROLLER_HPP 19 #define INC_ICONTROLLER_HPP 20 21 #include "Platform.hpp" 22 #include "ITrackSegment.hpp" 23 24 // Actions the user can send 25 enum Action { 26 BRAKE_TOGGLE, 27 SHOVEL_COAL, 28 THROTTLE_UP, 29 THROTTLE_DOWN, 30 TOGGLE_REVERSE, 31 }; 32 33 // Interface to something that can be controlled by the user 34 struct IController { ~IControllerIController35 virtual ~IController() {} 36 37 virtual void act_on(Action an_action) = 0; 38 39 // Get current values for the display 40 virtual int throttle() const = 0; 41 virtual bool brake_on() const = 0; 42 virtual bool reverse_on() const = 0; 43 virtual double pressure() const = 0; 44 virtual double temp() const = 0; 45 46 virtual bool stopped() const = 0; 47 }; 48 49 typedef shared_ptr<IController> IControllerPtr; 50 51 #endif 52