X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrafficmanager.h;h=266d2ff65ccf037eafcd7fdce468fddbd8bb9ad3;hb=02c9a9779954d993cb73fe5f7a72b0847e87f633;hp=83b03e2ec8c4684af75ab4adf5ca49d2d80321cd;hpb=06c100aacb559fbbe7380e15981c4772092c269b;p=r2c2.git diff --git a/source/libmarklin/trafficmanager.h b/source/libmarklin/trafficmanager.h index 83b03e2..266d2ff 100644 --- a/source/libmarklin/trafficmanager.h +++ b/source/libmarklin/trafficmanager.h @@ -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,22 +20,40 @@ class Turnout; class TrafficManager { public: + class Loader: public Msp::DataFile::BasicLoader + { + public: + Loader(TrafficManager &); + private: + void train(unsigned, unsigned); + }; + + sigc::signal signal_train_added; sigc::signal signal_block_reserved; +private: + Control &control; + Layout &layout; + std::list blocks; + std::list trains; + Msp::Time::TimeStamp last_tick; + +public: TrafficManager(Control &, Layout &); ~TrafficManager(); Control &get_control() const { return control; } - Block *get_block_by_track(const Track *) const; - const TrainSeq &get_trains() const { return trains; } + Layout &get_layout() const { return layout; } + const std::list &get_blocks() const { return blocks; } + Block &get_block(unsigned) const; + Block &get_block_by_track(const Track &) const; + const std::list &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: - Control &control; - Layout &layout; - BlockSeq blocks; - TrainSeq trains; - - void turnout_route_changed(unsigned, Turnout *); + void turnout_path_changed(unsigned, Turnout *); }; } // namespace Marklin