]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/trafficmanager.h
Forgot to add the new files
[r2c2.git] / source / libmarklin / trafficmanager.h
index 6e210bcf1f8a75430cfea680cd7f774bf8bd0b07..266d2ff65ccf037eafcd7fdce468fddbd8bb9ad3 100644 (file)
@@ -1,3 +1,10 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
 #ifndef LIBMARKLIN_TRAFFICMANAGER_H_
 #define LIBMARKLIN_TRAFFICMANAGER_H_
 
@@ -13,17 +20,40 @@ class Turnout;
 class TrafficManager
 {
 public:
-       TrafficManager(Control &, Layout &);
-       Control &get_control() const { return control; }
-       Block *get_block_by_track(const Track *) const;
-       void add_train(Train *);
+       class Loader: public Msp::DataFile::BasicLoader<TrafficManager>
+       {
+       public:
+               Loader(TrafficManager &);
+       private:
+               void train(unsigned, unsigned);
+       };
+
+       sigc::signal<void, Train &> signal_train_added;
+       sigc::signal<void, const Block &, const Train *> signal_block_reserved;
+
 private:
        Control &control;
        Layout &layout;
-       BlockSeq blocks;
-       TrainSeq trains;
+       std::list<Block *> blocks;
+       std::list<Train *> trains;
+       Msp::Time::TimeStamp last_tick;
 
-       void turnout_route_changed(unsigned, Turnout *);
+public:
+       TrafficManager(Control &, Layout &);
+       ~TrafficManager();
+
+       Control &get_control() const { return control; }
+       Layout &get_layout() const { return layout; }
+       const std::list<Block *> &get_blocks() const { return blocks; }
+       Block &get_block(unsigned) const;
+       Block &get_block_by_track(const Track &) const;
+       const std::list<Train *> &get_trains() const { return trains; }
+       Train &get_train_by_locomotive(const Locomotive &) const;
+       void add_train(Train *);
+       void tick();
+       void save(const std::string &) const;
+private:
+       void turnout_path_changed(unsigned, Turnout *);
 };
 
 } // namespace Marklin