Project
Loading...
Searching...
No Matches
test_CustomGUISokol.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 <boost/algorithm/string.hpp>
23
24#include <chrono>
25#include <iostream>
26#include <thread>
27
28using namespace o2::framework;
30
32{
33 return WorkflowSpec{
34 {"source",
35 Inputs{},
36 {
37 OutputSpec{{"test"}, "TST", "A"},
38 },
40 adaptStateless([](DataAllocator& outputs) {
41 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
42 auto& out = outputs.make<int>(OutputRef{"test", 0});
43 })}},
44 {"dest",
45 Inputs{
46 {"test", "TST", "A"}},
47 Outputs{},
49 [](CallbackService& callbacks) {
50 void* window = initGUI("A test window");
51 auto count = std::make_shared<int>(0);
52 sokol::init3DContext(window);
53
54 auto guiCallback = [count]() {
55 ImGui::Begin("Some sub-window");
56 ImGui::Text("Counter value: %i", *count);
57 ImGui::End();
58 sokol::render3D();
59 };
60 callbacks.set<CallbackService::Id::ClockTick>(
61 [count, window, guiCallback]() {
62 (*count)++; window ? pollGUI(window, guiCallback) : false; });
63 return adaptStateless([count](ControlService& control) {
64 if (*count > 1000) {
65 control.readyToQuit(QuitRequest::All);
66 }
67 });
68 })}}};
69}
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.