]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/aicontrol.h
Change the control system to separate speed and reverse
[r2c2.git] / source / libmarklin / aicontrol.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_AICONTROL_H_
9 #define LIBMARKLIN_AICONTROL_H_
10
11 #include <sigc++/trackable.h>
12 #include "controlmodel.h"
13 #include "traincontrol.h"
14
15 namespace Marklin {
16
17 class Train;
18
19 class AIControl: public ControlModel, public sigc::trackable
20 {
21 private:
22         Train &train;
23         ControlModel *next_model;
24         TrainControl target_speed;
25         bool blocked;
26         bool approach;
27
28 public:
29         AIControl(Train &, ControlModel *);
30         virtual ~AIControl();
31
32         virtual void set_control(const std::string &, float);
33         virtual const TrainControl &get_control(const std::string &) const;
34
35         virtual float get_speed() const;
36         virtual bool get_reverse() const;
37         virtual float get_braking_distance() const;
38
39         virtual void tick(const Msp::Time::TimeDelta &);
40
41 private:
42         void control_changed(const TrainControl &);
43         void arrived();
44 };
45
46 } // namespace Marklin
47
48 #endif