Skip to content

Commit f607094

Browse files
committed
DPL: move away from MessageSet::header / payload
Rest of the usecases removed. Abstract header / payload retrieval, with the idea that get_header / get_payload will work on any range of fair::mq::MessagePtrs.
1 parent ed42a58 commit f607094

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Framework/Core/src/DataRelayer.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ DataRelayer::ActivityStats DataRelayer::processDanglingInputs(std::vector<Expira
213213
auto partial = getPartialRecord(ti);
214214
// TODO: get the data ref from message model
215215
auto getter = [&partial](size_t idx, size_t part) {
216-
if (!partial[idx].messages.empty() && partial[idx].header(part).get()) {
217-
auto header = partial[idx].header(part).get();
218-
auto payload = partial[idx].payload(part).get();
216+
if (!partial[idx].messages.empty() && (partial[idx].messages | get_header{part}).get()) {
217+
auto header = (partial[idx].messages | get_header{part}).get();
218+
auto payload = (partial[idx].messages | get_payload{part, 0}).get();
219219
return DataRef{nullptr,
220220
reinterpret_cast<const char*>(header->GetData()),
221221
reinterpret_cast<char const*>(payload ? payload->GetData() : nullptr),
@@ -786,9 +786,9 @@ void DataRelayer::getReadyToProcess(std::vector<DataRelayer::RecordAction>& comp
786786
auto partial = getPartialRecord(li);
787787
// TODO: get the data ref from message model
788788
auto getter = [&partial](size_t idx, size_t part) {
789-
if (!partial[idx].messages.empty() && partial[idx].header(part).get()) {
790-
auto header = partial[idx].header(part).get();
791-
auto payload = partial[idx].payload(part).get();
789+
if (!partial[idx].messages.empty() && (partial[idx].messages | get_header{part}).get()) {
790+
auto header = (partial[idx].messages | get_header{part}).get();
791+
auto payload = (partial[idx].messages | get_payload{part, 0}).get();
792792
return DataRef{nullptr,
793793
reinterpret_cast<const char*>(header->GetData()),
794794
reinterpret_cast<char const*>(payload ? payload->GetData() : nullptr),
@@ -952,10 +952,10 @@ std::vector<o2::framework::MessageSet> DataRelayer::consumeExistingInputsForTime
952952
// TODO: in the original implementation of the cache, there have been only two messages per entry,
953953
// check if the 2 above corresponds to the number of messages.
954954
for (size_t pi = 0; pi < (cache[cacheId].messages | count_parts{}); pi++) {
955-
auto& header = cache[cacheId].header(pi);
955+
auto& header = cache[cacheId].messages | get_header{pi};
956956
auto&& newHeader = header->GetTransport()->CreateMessage();
957957
newHeader->Copy(*header);
958-
messages[arg].add(PartRef{std::move(newHeader), std::move(cache[cacheId].payload(pi))});
958+
messages[arg].add(PartRef{std::move(newHeader), std::move(cache[cacheId].messages | get_payload{pi, 0})});
959959
}
960960
};
961961

0 commit comments

Comments
 (0)