Project
Loading...
Searching...
No Matches
test_SimpleWildcard02.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18#include "Framework/Logger.h"
20#include <algorithm>
21#include <memory>
22#include <unordered_map>
23#include <TObjString.h>
24
25using namespace o2::framework;
26
28{
29 return {{"A1",
30 Inputs{},
31 Outputs{
32 OutputSpec{{"out"}, {"TST", "OUT"}}},
34 [](InitContext& initCtx) {
35 auto count = std::make_shared<unsigned int>(0);
36 return [count](ProcessingContext& ctx) {
37 TObjString s("abc");
38 for (int i = 0; i < 2; i++) {
39 ctx.outputs().snapshot(OutputRef{"out", *count}, s);
40 if (*count > 10) {
41 ctx.services().get<ControlService>().endOfStream();
42 ctx.services().get<ControlService>().readyToQuit(QuitRequest::Me);
43 }
44 (*count)++;
45 }
46 }; }}},
47 {"B",
48 Inputs{InputSpec{"in", ConcreteDataTypeMatcher{"TST", "OUT"}}},
49 Outputs{},
51 callbacks.set<CallbackService::Id::EndOfStream>([](EndOfStreamContext& context) {
52 context.services().get<ControlService>().readyToQuit(QuitRequest::All);
53 });
54 return adaptStateless([](InputRecord& inputs) {
55 auto s = inputs.get<TObjString*>("in");
56 auto n = inputs.getNofParts(0);
57 LOG(info) << "Number of parts " << inputs.getNofParts(0);
58 if (n != 2) {
59 LOG(error) << "Bad number of parts" << inputs.getNofParts(0);
60 }
61 for (size_t i = 0; i < n; ++i) {
62 auto ref = inputs.getByPos(0, i);
63 auto dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
64 LOG(info) << "String is " << s->GetString().Data() << " " << dh->subSpecification;
65 }
66 }); })}}};
67}
int32_t i
The input API of the Data Processing Layer This class holds the inputs which are valid for processing...
decltype(auto) get(R binding, int part=0) const
static DataRef getByPos(std::vector< InputRoute > const &routes, InputSpan const &span, int pos, int part=0)
size_t getNofParts(int pos) const
GLdouble n
Definition glcorearb.h:1982
GLint GLsizei count
Definition glcorearb.h:399
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
AlgorithmSpec::InitCallback adaptStateful(LAMBDA l)
WorkflowSpec defineDataProcessing(ConfigContext const &)
This function hooks up the the workflow specifications into the DPL driver.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"