Decoupling between Receiver and Processing
Currently the Receiver is parameterized with the processing class (and the detector class).
template <typename Detector, typename Processing>
class receiver;
This is necessary since the Processing parameters transits through the Receiver who is in charge of instantiating the Processing -the receivers is also a container of Processings:
std::shared_ptr<Processing> prepare_acq(acquisition_uid_t uuid, acq_params_t const& acq_params,
proc_params_t const& proc_params) {
// 1. Prepare receiver
// 2. Instantiate processing
// 3. Add processing to the container
}
The proposal is to externalize the creation of the processing so that the interface between the receiver is limited basically to the on_start
and on_frame_ready
callbacks. That would give:
class receiver
{
...
/// Register a callack for on acquisition start event
void register_on_start(std::function<void()> cbk);
/// Register a callack for on frame ready event
void register_on_frame_ready(std::function<void(data_t)> cbk);
/// Set a callack for on end of acquisition event
void register_on_end_acq(std::function<void(int)> cbk);
Now the clients (Tango) needs to follow the sequence:
// With the following data members
std::unique_ptr<receiver_t> m_recv;
processing_factory<processing_t> m_procs;
/////
// Prepare the receiver
auto acq_info = m_recv->prepare_acq(m_acq_params);
// Construct the processing
boost::uuids::string_generator gen;
proc = m_procs.construct(gen(uuid), m_recv->recv_rank(), acq_info, m_acq_params, m_proc_params);
if (proc) {
// Register the callbacks
using namespace std::placeholders;
m_recv->register_on_start(std::bind(&Processing::activate, proc));
m_recv->register_on_frame_ready(std::bind(&Processing::on_frame_ready, proc, _1));
}
-
Adapt the receiver -
Adapt the simulator (should simplify things) -
Adapt the Tango DS
Edited by Samuel Debionne