X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Froute.h;h=98b64f5c9ff11e9411bb987f8ad4d5877ab8bd3c;hb=651698847d5293cfb15b6fb23a394701388c0151;hp=f5b760265b5b30159fe44e2103ffe7691af81850;hpb=6c61179fe09af2f5366d50f10aadbf5f83438087;p=r2c2.git diff --git a/source/libmarklin/route.h b/source/libmarklin/route.h index f5b7602..98b64f5 100644 --- a/source/libmarklin/route.h +++ b/source/libmarklin/route.h @@ -1,27 +1,57 @@ +/* $Id$ + +This file is part of the MSP Märklin suite +Copyright © 2007-2010 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + #ifndef LIBMARKLIN_ROUTE_H_ #define LIBMARKLIN_ROUTE_H_ -#include +#include +#include #include -#include "track.h" +#include +#include namespace Marklin { -class Route +class Layout; +class Track; + +class Route: public sigc::trackable { public: - typedef std::map TurnoutMap; + class Loader: public Msp::DataFile::BasicLoader + { + public: + Loader(Route &); + private: + void turnout(unsigned, unsigned); + }; - Route(); - const TurnoutMap &get_turnouts() const { return turnouts; } - void add_track(Track *); - ~Route(); private: + Layout &layout; std::string name; - TrackSeq tracks; - TurnoutMap turnouts; + std::set tracks; + std::map turnouts; + +public: + Route(Layout &, const std::string &); + ~Route(); + + const std::string &get_name() const { return name; } + int get_turnout(unsigned) const; + const std::map &get_turnouts() const { return turnouts; } + void add_track(const Track &); + void add_tracks(const std::set &); + const std::set &get_tracks() const { return tracks; } + void save(std::list &) const; +private: + void update_turnouts(); + unsigned check_validity(const Track &) const; + void track_removed(Track &); }; -typedef std::list RouteSeq; } // namespace Marklin