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);
42 void wait_until(unsigned, unsigned);
62 std::vector<Msp::Variant> params;
67 Row(RowType, const T &);
70 const T &get_param(unsigned) const;
72 std::string str() const;
74 Msp::DataFile::Statement save() const;
76 static Row parse(const std::string &);
82 std::vector<Row> rows;
87 Msp::Time::TimeStamp wait_timeout;
92 void set_enabled(bool);
93 bool is_enabled() const { return enabled; }
97 void append(const Row &);
98 void insert(unsigned, const Row &);
99 unsigned get_n_rows() const { return rows.size(); }
100 const Row &get_row(unsigned) const;
102 void tick(const Msp::Time::TimeStamp &);
103 void save(std::list<Msp::DataFile::Statement> &) const;
105 Track &get_sensor(unsigned);
106 Zone &get_zone(const std::string &);
107 void sensor_event(unsigned, bool);
108 void train_arrived();