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"
17 class Signal: public Object
20 class Loader: public Msp::DataFile::ObjectLoader<Signal>
26 void address(unsigned);
27 void position(float, float, float);
32 const SignalType &type;
38 sigc::connection train_conn;
39 bool check_allocated_blocks;
43 Signal(Layout &, const SignalType &);
46 virtual Signal *clone(Layout * = 0) const;
47 virtual const SignalType &get_type() const { return type; }
49 void set_address(unsigned);
50 virtual void set_position(const Vector &);
51 virtual void set_rotation(float);
53 void normalize_location();
55 virtual Track *get_parent() const { return track; }
57 virtual unsigned get_n_snap_nodes() const;
58 virtual Snap get_snap_node(unsigned) const;
60 virtual SnapType get_default_snap_type_to(const Object &) const;
63 virtual bool collide_ray(const Vector &, const Vector &) const;
65 void tick(const Msp::Time::TimeDelta &);
68 void block_reserved(const Block &, Train *);
69 void train_advanced(Block &);
73 void save(std::list<Msp::DataFile::Statement> &) const;