]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/timetable.h
Change the control system to separate speed and reverse
[r2c2.git] / source / libmarklin / timetable.h
index 39cff5ee6b2b14a077445521783ac2039630acd9..ec4212e64c459da07895ed4c3958a9a6e67abcd0 100644 (file)
@@ -10,6 +10,7 @@ Distributed under the GPL
 
 #include <string>
 #include <vector>
+#include <sigc++/trackable.h>
 #include <msp/datafile/objectloader.h>
 #include <msp/time/timestamp.h>
 
@@ -18,7 +19,7 @@ namespace Marklin {
 class Block;
 class Train;
 
-class Timetable
+class Timetable: public sigc::trackable
 {
 public:
        class Loader: public Msp::DataFile::ObjectLoader<Timetable>
@@ -50,10 +51,15 @@ public:
 
                Row(RowType, int);
                Row(RowType, const std::string &);
+
+               std::string str() const;
+
+               static Row parse(const std::string &);
        };
 
 private:
        Train &train;
+       bool enabled;
        std::vector<Row> rows;
        unsigned current_row;
        bool executing;
@@ -63,6 +69,16 @@ private:
 public:
        Timetable(Train &);
 
+       void set_enabled(bool);
+       bool is_enabled() const { return enabled; }
+       void reset();
+
+       void clear();
+       void append(const Row &);
+       void insert(unsigned, const Row &);
+       unsigned get_n_rows() const { return rows.size(); }
+       const Row &get_row(unsigned) const;
+
        void tick(const Msp::Time::TimeStamp &);
        void save(std::list<Msp::DataFile::Statement> &) const;
 private: