X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftimetable.h;fp=source%2Flibmarklin%2Ftimetable.h;h=0000000000000000000000000000000000000000;hb=1ff06c5bc46a677fa389ef86c6b26664368f1653;hp=b4f9cc1b2fd2972ed097926e54c31a45824101f5;hpb=9b05c573a38639827697fe393d55b7c76f5bde45;p=r2c2.git diff --git a/source/libmarklin/timetable.h b/source/libmarklin/timetable.h deleted file mode 100644 index b4f9cc1..0000000 --- a/source/libmarklin/timetable.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - -#ifndef LIBMARKLIN_TIMETABLE_H_ -#define LIBMARKLIN_TIMETABLE_H_ - -#include -#include -#include -#include -#include - -namespace Marklin { - -class Block; -class Train; - -class Timetable: public sigc::trackable -{ -public: - class Loader: public Msp::DataFile::ObjectLoader - { - public: - Loader(Timetable &); - private: - void arrive(); - void go_to(const std::string &); - void route(const std::string &); - void reverse(); - void speed(unsigned); - void travel(const std::string &); - void wait(unsigned); - void wait_train(unsigned, const std::string &); - }; - - enum RowType - { - GOTO, - TRAVEL, - WAIT_TIME, - WAIT_TRAIN, - ARRIVE, - SPEED, - REVERSE, - ROUTE - }; - - struct Row - { - RowType type; - std::vector params; - - Row(RowType); - - template - Row(RowType, const T &); - - template - const T &get_param(unsigned) const; - - std::string str() const; - - Msp::DataFile::Statement save() const; - - static Row parse(const std::string &); - }; - -private: - Train &train; - bool enabled; - std::vector rows; - unsigned current_row; - bool executing; - Block *pending_block; - Train *pending_train; - Msp::Time::TimeStamp wait_timeout; - -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 &) const; -private: - Block &parse_location(const std::string &); - void sensor_event(unsigned, bool); - void train_arrived(); -}; - -} // namespace Marklin - -#endif