return BeamGateType::instance();
}
-void BeamGate::set_address(unsigned a)
-{
- address = a;
-}
-
void BeamGate::set_position(const Vector &p)
{
position = p;
virtual BeamGate *clone(Layout * = 0) const;
virtual const BeamGateType &get_type() const;
- void set_address(unsigned);
virtual void set_position(const Vector &);
virtual void set_rotation(const Angle &);
virtual void set_tilt(const Angle &) { }
layout.remove(*this);
}
+void Sensor::set_address(unsigned a)
+{
+ address = a;
+ if(layout.has_driver())
+ layout.get_driver().add_sensor(address);
+}
+
void Sensor::tick(const Time::TimeDelta &dt)
{
if(state_confirm_timeout)
public:
virtual ~Sensor();
+ virtual void set_address(unsigned);
unsigned get_address() const { return address; }
State get_state() const { return state; }
virtual Block *get_block() const { return 0; }
sensor_id = i;
layout.create_blocks(*this);
- if(layout.has_driver() && sensor_id)
- layout.get_driver().add_sensor(sensor_id);
}
void Track::set_active_path(unsigned p)
+#include <stdexcept>
#include "block.h"
#include "trackcircuit.h"
+using namespace std;
+
namespace R2C2 {
TrackCircuit::TrackCircuit(Layout &l, Block &b):
Sensor(l),
block(b)
{
- address = block.get_sensor_id();
+ Sensor::set_address(block.get_sensor_id());
+}
+
+void TrackCircuit::set_address(unsigned)
+{
+ throw logic_error("use Track::set_sensor_id");
}
} // namespace R2C2
public:
TrackCircuit(Layout &, Block &);
+ virtual void set_address(unsigned);
virtual Block *get_block() const { return █ }
};