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"
10 #include "trackattachment.h"
17 class Signal: public TrackAttachment
20 class Loader: public Msp::DataFile::ObjectLoader<Signal>
26 void address(unsigned);
27 void position(float, float, float);
32 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 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;