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;
36 sigc::connection train_conn;
37 bool check_allocated_blocks;
41 Signal(Layout &, const SignalType &);
44 virtual Signal *clone(Layout * = 0) const;
45 virtual const SignalType &get_type() const { return type; }
47 void set_address(unsigned);
48 unsigned get_address() const { return address; }
49 virtual void set_position(const Vector &);
50 virtual void set_rotation(const Angle &);
51 virtual void set_tilt(const Angle &) { }
53 void update_attachment();
56 virtual unsigned get_n_snap_nodes() const;
57 virtual Snap get_snap_node(unsigned) const;
59 virtual SnapType get_default_snap_type_to(const Object &) const;
62 void tick(const Msp::Time::TimeDelta &);
65 void block_reserved(const Block &, Train *);
66 void train_advanced(Block &);
70 void save(std::list<Msp::DataFile::Statement> &) const;