1 #ifndef LIBR2C2_SIGNAL_H_
2 #define LIBR2C2_SIGNAL_H_
4 #include <msp/datafile/objectloader.h>
5 #include <msp/time/timedelta.h>
8 #include "signaltype.h"
9 #include "trackattachment.h"
16 class Signal: public TrackAttachment
19 class Loader: public Msp::DataFile::ObjectLoader<Signal>
25 void address(unsigned);
26 void position(float, float, float);
31 const SignalType &type;
35 sigc::connection train_conn;
36 bool check_allocated_blocks;
40 Signal(Layout &, const SignalType &);
43 virtual Signal *clone(Layout * = 0) const;
44 virtual const SignalType &get_type() const { return type; }
46 void set_address(unsigned);
47 unsigned get_address() const { return address; }
48 virtual void set_position(const Vector &);
49 virtual void set_rotation(const Angle &);
50 virtual void set_tilt(const Angle &) { }
52 void update_attachment();
55 virtual unsigned get_n_snap_nodes() const;
56 virtual Snap get_snap_node(unsigned) const;
58 virtual SnapType get_default_snap_type_to(const Object &) const;
61 void tick(const Msp::Time::TimeDelta &);
64 void block_reserved(const Block &, Train *);
65 void train_advanced(Block &);
69 void save(std::list<Msp::DataFile::Statement> &) const;