1 #ifndef LIBR2C2_BLOCK_H_
2 #define LIBR2C2_BLOCK_H_
7 #include "trackchain.h"
17 class Block: public TrackChain
26 Endpoint(Track *, unsigned);
28 TrackIter track_iter() const;
31 sigc::signal<void, Train *> signal_reserved;
36 unsigned turnout_addr;
39 std::vector<Endpoint> endpoints;
43 Block(Layout &, Track &);
46 virtual void set_name(const std::string &);
49 virtual void on_track_added(Track &);
50 virtual Validity check_validity(Track &) const;
53 unsigned get_id() const { return id; }
54 unsigned get_sensor_address() const { return sensor_addr; }
55 unsigned get_turnout_address() const { return turnout_addr; }
56 TrackCircuit *get_sensor() const { return sensor; }
57 const std::vector<Endpoint> &get_endpoints() const { return endpoints; }
58 const Endpoint &get_endpoint(unsigned) const;
59 int get_endpoint_by_link(Block &) const;
60 float get_path_length(unsigned, const Route * = 0) const;
61 void check_link(Block &);
62 void break_link(Block &);
63 Block *get_link(unsigned) const;
64 bool reserve(Train *);
65 Train *get_train() const { return train; }
70 virtual Msp::DataFile::Statement save_reference() const;