@@ -27,7 +27,7 @@ namespace workflows
2727// This is a possible implementation of a DPL compliant and generic gatherer
2828// Every other implementation should fall back to this one, after required translations.
2929o2f::DataProcessorSpec defineMerger (std::string devName, o2f::Inputs usrInputs, o2f::OutputSpec usrOutput,
30- std::function<void (OutputBuffer, const o2f::DataRef)> const mergerFunc)
30+ std::function<void (OutputBuffer& , const o2f::DataRef)> const mergerFunc)
3131{
3232 return {devName, // Device name from user
3333 usrInputs, // User defined input as a vector of one InputSpec
@@ -36,18 +36,17 @@ o2f::DataProcessorSpec defineMerger(std::string devName, o2f::Inputs usrInputs,
3636 o2f::AlgorithmSpec{[usrOutput, mergerFunc](o2f::InitContext&) {
3737 // Creating shared ptrs to useful parameters
3838 auto outputPtr = std::make_shared<o2f::Output>(getOutput (usrOutput));
39- auto mergerFuncPtr = std::make_shared<std::function<void (OutputBuffer, o2f::DataRef)> const >(mergerFunc);
39+ auto mergerFuncPtr = std::make_shared<std::function<void (OutputBuffer& , o2f::DataRef)> const >(mergerFunc);
4040
4141 // Defining the ProcessCallback as returned object of InitCallback
4242 return [outputPtr, mergerFuncPtr](o2f::ProcessingContext& ctx) {
43- OutputBuffer outputBuffer;
43+ OutputBuffer outputBuffer = ctx. outputs (). makeVector < char >(*outputPtr) ;
4444 // Iterating over the InputSpecs to aggregate msgs from the connected devices
4545 for (const auto & itInputs : ctx.inputs ()) {
4646 (*mergerFuncPtr)(outputBuffer, itInputs);
4747 }
4848 // Adopting the buffer as new chunk
49- ctx.outputs ().adoptChunk ((*outputPtr), &outputBuffer[0 ], outputBuffer.size (), &freefn,
50- nullptr );
49+ ctx.outputs ().adoptContainer ((*outputPtr), std::move (outputBuffer));
5150 };
5251 }}};
5352}
@@ -56,7 +55,7 @@ o2f::DataProcessorSpec defineMerger(std::string devName, o2f::Inputs usrInputs,
5655o2f::DataProcessorSpec defineMerger (std::string devName, o2f::Inputs usrInputs, o2f::OutputSpec usrOutput)
5756{
5857 // This lambda retrieves the payload size through the API and back-inserts it on the output buffer
59- auto funcMerge = [](OutputBuffer buf, const o2f::DataRef d) {
58+ auto funcMerge = [](OutputBuffer& buf, const o2f::DataRef d) {
6059 auto msgSize = (o2::header::get<o2::header::DataHeader*>(d.header ))->payloadSize ;
6160 buf.resize (buf.size () + msgSize);
6261 std::copy (&(d.payload [0 ]), &(d.payload [msgSize - 1 ]), std::back_inserter (buf));
0 commit comments