Project
Loading...
Searching...
No Matches
test_CallbackService.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#include <boost/algorithm/string.hpp>
12
13#include "Framework/InputSpec.h"
19
20#include <chrono>
21#include <thread>
22
23using namespace o2::framework;
25
27{
28 return WorkflowSpec{
29 {"source",
30 Inputs{},
31 {
32 OutputSpec{{"test"}, "TST", "A"},
33 },
35 [](ProcessingContext& ctx) {
36 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
37 auto& out = ctx.outputs().make<int>(OutputRef{"test", 0});
38 }}},
39 {"dest",
40 Inputs{
41 {"test", "TST", "A"}},
42 Outputs{},
44 [](InitContext& ic) {
45 auto count = std::make_shared<int>(0);
46 auto callback = [count]() {
47 (*count)++;
48 };
49 ic.services().get<CallbackService>().set<CallbackService::Id::ClockTick>(callback);
50 return [count](ProcessingContext& ctx) {
51 if (*count > 10) {
52 ctx.services().get<ControlService>().readyToQuit(QuitRequest::All);
53 }
54 };
55 }}}};
56}
GLint GLsizei count
Definition glcorearb.h:399
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
the main header struct
Definition DataHeader.h:618
WorkflowSpec defineDataProcessing(ConfigContext const &)
This function hooks up the the workflow specifications into the DPL driver.