ChimeraTK-ApplicationCore 04.06.00
Loading...
Searching...
No Matches
ScriptedInitialisationHandler.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 "ApplicationModule.h"
6#include "ScalarAccessor.h"
7
8namespace ChimeraTK {
9
10 class DeviceModule;
11
47 ScriptedInitHandler(ModuleGroup* owner, const std::string& name, const std::string& description,
48 std::string command, DeviceModule& deviceModule, std::string outputName = "initScriptOutput",
49 unsigned int errorGracePeriod = 10);
50 void mainLoop() override {
51 } // no main loop needed. doInit() is called from the DeviceModule thread as initialisation handler
52 void doInit();
53
54 protected:
55 bool _lastFailed{false};
56 std::string _command;
57 std::string _deviceAlias;
58 std::string _outputName;
59 unsigned int _errorGracePeriod; // additional sleep time before a retry after an error
60 //_scriptOutput must be in this file after _outputName so the latter can be used as constructor parameter
62 RegisterPath("/Devices") / Utilities::escapeName(_deviceAlias, false) / _outputName, "",
63 "stdout+stderr of init script"};
64 };
65
66} // namespace ChimeraTK
std::string escapeName(const std::string &name, bool allowDotsAndSlashes)
Convert all characters which are not allowed in variable or module names into underscores followed by...
Definition Utilities.cc:45
InvalidityTracer application module.
Convenience class for output scalar accessors (always UpdateMode::push)
Initialisation handler which calls an external application (usually a script), captures its output (b...
void mainLoop() override
To be implemented by the user: function called in a separate thread executing the main loop of the mo...