]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/trafficmanager.h
2707e098fb6caad5f339cfa57f805c8caeec9d3e
[r2c2.git] / source / libmarklin / trafficmanager.h
1 #ifndef LIBMARKLIN_TRAFFICMANAGER_H_
2 #define LIBMARKLIN_TRAFFICMANAGER_H_
3
4 #include "block.h"
5 #include "train.h"
6
7 namespace Marklin {
8
9 class Control;
10 class Layout;
11 class Turnout;
12
13 class TrafficManager
14 {
15 public:
16         sigc::signal<void, const Block &, const Train *> signal_block_reserved;
17
18         TrafficManager(Control &, Layout &);
19         ~TrafficManager();
20
21         Control &get_control() const { return control; }
22         Block &get_block_by_track(const Track &) const;
23         const TrainSeq &get_trains() const { return trains; }
24         void add_train(Train *);
25         void tick();
26 private:
27         Control &control;
28         Layout &layout;
29         std::list<Block *> blocks;
30         std::list<Train *> trains;
31
32         void turnout_route_changed(unsigned, Turnout *);
33 };
34
35 } // namespace Marklin
36
37 #endif