Project
Loading...
Searching...
No Matches
test_CustomGUIGL.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 "Framework/InputSpec.h"
17
18#include <DebugGUI/DebugGUI.h>
19#include <DebugGUI/Sokol3DUtils.h>
20#include <DebugGUI/imgui.h>
21
22#include <chrono>
23#include <iostream>
24#include <thread>
25
26using namespace o2::framework;
28
30{
31 return WorkflowSpec{
32 {"source",
33 Inputs{},
34 {
35 OutputSpec{{"test"}, "TST", "A"},
36 },
38 adaptStateless([](DataAllocator& outputs) {
39 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
40 auto& out = outputs.make<int>(OutputRef{"test", 0});
41 })}},
42 {"dest",
43 Inputs{
44 {"test", "TST", "A"}},
45 Outputs{},
47 [](CallbackService& callbacks) {
48 void* window = initGUI("A test window");
49 auto count = std::make_shared<int>(0);
50 sokol::init3DContext(window);
51
52 auto guiCallback = [count]() {
53 ImGui::Begin("Some sub-window");
54 ImGui::Text("Counter value: %i", *count);
55 ImGui::End();
56 sokol::render3D();
57 };
58 callbacks.set<CallbackService::Id::ClockTick>(
59 [count, window, guiCallback]() {
60 (*count)++; window ? pollGUI(window, guiCallback) : false; });
61 return adaptStateless([count](ControlService& control) {
62 if (*count > 1000) {
63 control.readyToQuit(QuitRequest::All);
64 }
65 });
66 })}}};
67}
void readyToQuit(bool all)
Compatibility with old API.
decltype(auto) make(const Output &spec, Args... args)
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)
the main header struct
Definition DataHeader.h:618
WorkflowSpec defineDataProcessing(ConfigContext const &)
This function hooks up the the workflow specifications into the DPL driver.