1 #ifndef LIBMARKLIN_TRAIN_H_
2 #define LIBMARKLIN_TRAIN_H_
4 #include <sigc++/signal.h>
5 #include <sigc++/trackable.h>
6 #include <msp/time/timestamp.h>
15 class Train: public sigc::trackable
23 BlockRef(Block *s, unsigned e): block(s), entry(e) { }
26 TrafficManager &trfc_mgr;
29 std::list<BlockRef> cur_blocks;
30 std::list<BlockRef> rsv_blocks;
31 unsigned target_speed;
32 Msp::Time::TimeStamp try_reserve;
35 sigc::signal<void, const std::string &> signal_name_changed;
37 Train(TrafficManager &, Locomotive &);
38 void set_name(const std::string &);
39 void set_speed(unsigned);
40 const std::string &get_name() const { return name; }
41 Locomotive &get_locomotive() const { return loco; }
42 void place(Block *, unsigned);
43 bool free_block(Block *);
44 void tick(const Msp::Time::TimeStamp &);
46 void sensor_event(bool, Sensor *);
49 typedef std::list<Train *> TrainSeq;
51 } // namespace Marklin