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;
80 void append_row(const Row &);
81 void insert_row(unsigned, const Row &);
82 void modify_row(unsigned, const Row &);
83 void remove_row(unsigned);
85 unsigned get_length() const { return rows.size(); }
86 const Row &get_row(unsigned) const;
88 virtual void tick(const Msp::Time::TimeDelta &);
90 void save(std::list<Msp::DataFile::Statement> &) const;
93 void check_update(std::list<Row>::const_iterator);
94 std::list<Row>::iterator find_trip(const std::list<Row>::iterator &, std::list<Row>::iterator *);
96 void event(TrainAI &, const Message &);