using namespace std;
using namespace Msp;
-#include <msp/io/print.h>
-
namespace R2C2 {
Signal::Signal(Layout &l, const SignalType &t):
int train_entry = train->get_entry_to_block(*block);
if(train_entry>=0 && static_cast<unsigned>(train_entry)==entry)
{
- IO::print("Train passing in the proper direction\n");
if(train_conn)
train_conn.disconnect();
train_conn = train->signal_advanced.connect(sigc::mem_fun(this, &Signal::train_advanced));
}
- else
- IO::print("Train passing in the wrong direction (entry=%d, train_entry=%d)\n", entry, train_entry);
check_train_direction = false;
check_allocated_blocks = true;
}
++n_blocks;
iter=iter.next();
}
- IO::print("%d sensor blocks allocated\n", n_blocks);
check_allocated_blocks = false;
const list<SignalType::Indication> &indications = type.get_indications();
break;
}
- IO::print("Setting signal %d to aspect %d\n", address, aspect);
layout.get_driver().set_signal(address, aspect);
}
}
void Signal::train_advanced(Block &b)
{
if(&b==block)
- {
- IO::print("Train is passing the signal now\n");
passing = true;
- }
else if(passing && b.get_sensor_id())
{
- IO::print("Train has passed the signal\n");
layout.get_driver().set_signal(address, type.get_indications().back().aspect);
reset();
}