]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/aicontrol.h
Foundations of using physics simulation for trains
[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
27 public:
28         AIControl(Train &, ControlModel *);
29         virtual ~AIControl();
30
31         virtual void set_control(const std::string &, float);
32         virtual const TrainControl &get_control(const std::string &) const;
33
34         virtual float get_speed() const;
35         virtual float get_braking_distance() const;
36
37         virtual void tick(const Msp::Time::TimeDelta &);
38
39 private:
40         void arrived();
41 };
42
43 } // namespace Marklin
44
45 #endif