ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
PyApplicationModule.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2// SPDX-License-Identifier: LGPL-3.0-or-later
3#pragma once
4
5#include <pybind11/pybind11.h>
6// pybind11.h must come first
7
8#include "ApplicationModule.h"
10
11namespace py = pybind11;
12
13namespace ChimeraTK {
14
15 /********************************************************************************************************************/
16
18 public:
20
21 void run() override;
22 void terminate() override;
23
24 // change visibility since we need to call this from Python
26
27 static void bind(py::module& mod);
28
29 private:
30 py::object _myThread;
31 };
32
33 /********************************************************************************************************************/
34
36 public:
37 using PyApplicationModule::PyApplicationModule;
38
39 void mainLoop() override {
40 PYBIND11_OVERRIDE_PURE(void, /* Return type */
41 PyApplicationModule, /* Parent class */
42 mainLoop /* Name of function in C++ (must match Python name) */
43 );
44 }
45
46 void prepare() override { PYBIND11_OVERRIDE(void, PyApplicationModule, prepare); }
47 };
48
49 /********************************************************************************************************************/
50
51} // namespace ChimeraTK
ApplicationModule()=default
Default constructor: Allows late initialisation of modules (e.g.
void mainLoopWrapper()
Wrapper around mainLoop(), to execute additional tasks in the thread before entering the main loop.
void terminate() override
Terminate the module.
static void bind(py::module &mod)
void run() override
Execute the module.
Base class used for all objects in the Python world which can own other objects and can be owned them...
void mainLoop() override
To be implemented by the user: function called in a separate thread executing the main loop of the mo...
void prepare() override
Prepare the execution of the module.
InvalidityTracer application module.
module_ module