1 #ifndef LIBMARKLIN_TRAIN_H_
2 #define LIBMARKLIN_TRAIN_H_
4 #include <sigc++/signal.h>
5 #include <sigc++/trackable.h>
13 class Train: public sigc::trackable
16 sigc::signal<void, const std::string &> signal_name_changed;
18 Train(TrafficManager &, Locomotive &);
19 void set_name(const std::string &);
20 void set_speed(unsigned);
21 const std::string &get_name() const { return name; }
22 Locomotive &get_locomotive() const { return loco; }
23 void place(Block *, const Block::Endpoint *);
24 bool free_block(Block *);
30 const Block::Endpoint *entry;
32 BlockRef(Block *s, const Block::Endpoint *e): block(s), entry(e) { }
34 typedef std::list<BlockRef> BlockRefSeq;
36 TrafficManager &trfc_mgr;
39 BlockRefSeq cur_blocks;
40 BlockRefSeq rsv_blocks;
41 unsigned target_speed;
43 void sensor_event(unsigned, bool);
46 typedef std::list<Train *> TrainSeq;
48 } // namespace Marklin