3 This file is part of R²C²
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBR2C2_TIMETABLE_H_
9 #define LIBR2C2_TIMETABLE_H_
13 #include <sigc++/trackable.h>
14 #include <msp/datafile/objectloader.h>
15 #include <msp/time/timestamp.h>
24 class Timetable: public sigc::trackable
27 class Loader: public Msp::DataFile::ObjectLoader<Timetable>
33 void goto_sensor(unsigned);
34 void goto_sensor(const std::string &);
35 void goto_zone(const std::string &);
36 void route(const std::string &);
39 void travel(const std::string &);
41 void wait_train(unsigned, unsigned);
60 std::vector<Msp::Variant> params;
65 Row(RowType, const T &);
68 const T &get_param(unsigned) const;
70 std::string str() const;
72 Msp::DataFile::Statement save() const;
74 static Row parse(const std::string &);
80 std::vector<Row> rows;
85 Msp::Time::TimeStamp wait_timeout;
90 void set_enabled(bool);
91 bool is_enabled() const { return enabled; }
95 void append(const Row &);
96 void insert(unsigned, const Row &);
97 unsigned get_n_rows() const { return rows.size(); }
98 const Row &get_row(unsigned) const;
100 void tick(const Msp::Time::TimeStamp &);
101 void save(std::list<Msp::DataFile::Statement> &) const;
103 Track &get_sensor(unsigned);
104 Zone &get_zone(const std::string &);
105 void sensor_event(unsigned, bool);
106 void train_arrived();