]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/trafficmanager.h
Add Id tags and copyright notices to files
[r2c2.git] / source / libmarklin / trafficmanager.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_TRAFFICMANAGER_H_
9 #define LIBMARKLIN_TRAFFICMANAGER_H_
10
11 #include "block.h"
12 #include "train.h"
13
14 namespace Marklin {
15
16 class Control;
17 class Layout;
18 class Turnout;
19
20 class TrafficManager
21 {
22 private:
23         Control &control;
24         Layout &layout;
25         std::list<Block *> blocks;
26         std::list<Train *> trains;
27
28 public:
29         sigc::signal<void, const Block &, const Train *> signal_block_reserved;
30
31         TrafficManager(Control &, Layout &);
32         ~TrafficManager();
33
34         Control &get_control() const { return control; }
35         const std::list<Block *> &get_blocks() const { return blocks; }
36         Block &get_block_by_track(const Track &) const;
37         const std::list<Train *> &get_trains() const { return trains; }
38         void add_train(Train *);
39         void tick();
40 private:
41         void turnout_route_changed(unsigned, Turnout *);
42 };
43
44 } // namespace Marklin
45
46 #endif