3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_TIMETABLE_H_
9 #define LIBMARKLIN_TIMETABLE_H_
13 #include <sigc++/trackable.h>
14 #include <msp/datafile/objectloader.h>
15 #include <msp/time/timestamp.h>
22 class Timetable: public sigc::trackable
25 class Loader: public Msp::DataFile::ObjectLoader<Timetable>
31 void go_to(const std::string &);
32 void route(const std::string &);
35 void travel(const std::string &);
37 void wait_train(unsigned, const std::string &);
55 std::vector<Msp::Variant> params;
60 Row(RowType, const T &);
63 const T &get_param(unsigned) const;
65 std::string str() const;
67 Msp::DataFile::Statement save() const;
69 static Row parse(const std::string &);
75 std::vector<Row> rows;
80 Msp::Time::TimeStamp wait_timeout;
85 void set_enabled(bool);
86 bool is_enabled() const { return enabled; }
90 void append(const Row &);
91 void insert(unsigned, const Row &);
92 unsigned get_n_rows() const { return rows.size(); }
93 const Row &get_row(unsigned) const;
95 void tick(const Msp::Time::TimeStamp &);
96 void save(std::list<Msp::DataFile::Statement> &) const;
98 Block &parse_location(const std::string &);
99 void sensor_event(unsigned, bool);
100 void train_arrived();
103 } // namespace Marklin