1 #ifndef LIBR2C2_TIMETABLE_H_
2 #define LIBR2C2_TIMETABLE_H_
4 #include <msp/datafile/objectloader.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 &, unsigned);
52 Msp::Time::TimeDelta time;
56 void save(std::list<Msp::DataFile::Statement> &) const;
63 RowTypeMatch(RowType t): type(t) { }
65 bool operator()(const Row &r) const { return r.type==type; }
68 sigc::signal<void, unsigned, const Row &> signal_row_added;
69 sigc::signal<void, unsigned, const Row &> signal_row_modified;
70 sigc::signal<void, unsigned> signal_row_removed;
74 std::list<Row>::iterator current_row;
81 void append_row(const Row &);
82 void insert_row(unsigned, const Row &);
83 void modify_row(unsigned, const Row &);
84 void remove_row(unsigned);
86 unsigned get_length() const { return rows.size(); }
87 const Row &get_row(unsigned) const;
89 virtual void tick(const Msp::Time::TimeDelta &);
91 void save(std::list<Msp::DataFile::Statement> &) const;
94 void check_update(const std::list<Row>::const_iterator &);
95 std::list<Row>::iterator find_trip(const std::list<Row>::iterator &, std::list<Row>::iterator *);
97 void event(TrainAI &, const Message &);