DUNE-DAQ / iomanager

Package providing a unified API
0 stars 0 forks source link

Expose conn_id fields based on conn_ref #11

Closed roland-sipos closed 2 years ago

roland-sipos commented 2 years ago

After a discussion with @eflumerf , we identified potential needs to have accessors for the m_conn_id member in the Sender/Receiver concepts, but a ref_to_id being public in IOManager would be needed in situations when a plugin wants to make a decision which Sender/Receiver instances to get, based on connectionID details. One notable example is flxlibs and readoutmodules:

In flxlibs, to set up appropriate Senders, one needs to do:

std::unique_ptr<ElinkConcept>
createElinkModel(const std::string& sink_name, const std::string& datatype) 
{
  if (datatype.find("WIB_SUPERCHUNK_STRUCT") != std::string::npos) { // WIB1 specific char arrays

    // Create Model (need to select appropriate serializer for FELIX chunks to target type)
    auto elink_model = std::make_unique<ElinkModel<fdreadoutlibs::types::WIB_SUPERCHUNK_STRUCT>>();

    // Setup sink from IOManager based on conn_ref
    elink_model->set_sink(sink_name);

    ...

With ref_to_id being private, the following planned modification doesn't work:

auto connid = iomanager::IOManager::get()->ref_to_id(qi);
TLOG_DEBUG(TLVL_WORK_STEPS) << "Creating ElinkModel for target queue: " << qi.uid
                                                               << " DLH number: " << linkid
                                                               << " DataType: " << connid.data_type;
m_elinks[linkid] = createElinkModel(qi.uid, connid.data_type);
roland-sipos commented 2 years ago

Related issues: https://github.com/DUNE-DAQ/flxlibs/issues/48 https://github.com/DUNE-DAQ/readoutmodules/issues/7