3 This file is part of the MSP Märklin suite
4 Copyright © 2007-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_ROUTE_H_
9 #define LIBMARKLIN_ROUTE_H_
14 #include <sigc++/trackable.h>
15 #include <msp/datafile/loader.h>
23 class Route: public sigc::trackable
26 typedef std::map<unsigned, int> TurnoutMap;
28 class Loader: public Msp::DataFile::BasicLoader<Route>
36 virtual void finish();
37 void turnout(unsigned, unsigned);
40 sigc::signal<void, const std::string &> signal_name_changed;
46 std::set<Track *> tracks;
53 void set_name(const std::string &);
54 const std::string &get_name() const { return name; }
55 void set_temporary(bool);
56 bool is_temporary() const { return temporary; }
57 void set_turnout(unsigned, unsigned);
58 void update_turnouts();
59 int get_turnout(unsigned) const;
60 unsigned get_path(Track &) const;
61 const std::map<unsigned, int> &get_turnouts() const { return turnouts; }
62 void add_track(Track &);
63 void add_tracks(const std::set<Track *> &);
64 void add_track_chain(Track &, unsigned, const TurnoutMap &);
65 const std::set<Track *> &get_tracks() const { return tracks; }
66 bool has_track(Track &) const;
67 void save(std::list<Msp::DataFile::Statement> &) const;
69 unsigned check_validity(Track &) const;
70 void track_removed(Track &);
73 static Route *find(const TrackIter &, Track &);
74 static Route *find(const TrackIter &, const Route &);
75 static Route *find(const TrackIter &, const std::set<Track *> &);
78 } // namespace Marklin