1 #ifndef LIBR2C2_TIMETABLE_H_
2 #define LIBR2C2_TIMETABLE_H_
4 #include <msp/datafile/objectloader.h>
5 #include "trackchain.h"
12 class Timetable: public TrainAI
15 class Loader: public Msp::DataFile::ObjectLoader<Timetable>
21 Loader(Timetable &, Layout &);
36 class Loader: public Msp::DataFile::ObjectLoader<Row>
42 Loader(Row &, Layout &);
46 void time(Msp::Time::RawTime);
47 void zone(const std::string &);
48 void zone_numbered(const std::string &, unsigned);
53 TrackChain::Direction direction;
54 Msp::Time::TimeDelta time;
58 void save(std::list<Msp::DataFile::Statement> &) const;
65 RowTypeMatch(RowType t): type(t) { }
67 bool operator()(const Row &r) const { return r.type==type; }
70 sigc::signal<void, unsigned, const Row &> signal_row_added;
71 sigc::signal<void, unsigned, const Row &> signal_row_modified;
72 sigc::signal<void, unsigned> signal_row_removed;
76 std::list<Row>::iterator current_row;
80 std::list<Row>::iterator next_depart;
85 void append_row(const Row &);
86 void insert_row(unsigned, const Row &);
87 void modify_row(unsigned, const Row &);
88 void remove_row(unsigned);
90 unsigned get_length() const { return rows.size(); }
91 const Row &get_row(unsigned) const;
93 virtual void tick(const Msp::Time::TimeDelta &);
95 bool passed_row(const Row &, const Msp::Time::TimeDelta &) const;
98 void save(std::list<Msp::DataFile::Statement> &) const;
101 void check_update(const std::list<Row>::const_iterator &);
102 std::list<Row>::iterator find_trip(const std::list<Row>::iterator &, std::list<Row>::iterator *);
104 void event(TrainAI &, const Message &);
106 void clock_discontinuity();