13#ifndef RTCTK_EXAMPLE_DATATASK_OPTIMISER_BUSINESSLOGIC_HPP
14#define RTCTK_EXAMPLE_DATATASK_OPTIMISER_BUSINESSLOGIC_HPP
34 , m_oldb(services.Get<
OldbIf>())
35 , m_dp_slopes(
"/common/static/wfs_1/slopes")
36 , m_dp_nacts(
"/common/static/dm_1/acts")
37 , m_dp_im(
"/" + name +
"/" +
"dynamic/im")
38 , m_dp_cm(
"/" + name +
"/" +
"dynamic/cm")
39 , m_dp_stats_time(
"/" + name +
"/" +
"statistics/computation/time")
58 auto result = m_computation.Compute(ParseAlgorithm(
arg));
61 m_oldb.
SetDataPoint<
double>(m_dp_stats_time, result.stats.elapsed.count());
66 const std::string
alg_key =
"algorithm";
70 err_text <<
"No algorithm specified: ";
71 for (
auto& [
key, value] :
arg.items()) {
79 if (value ==
"SimpleInversion") {
81 }
else if (value ==
"PythonInversion") {
85 err_text <<
"Invalid algorithm specified: ";
86 for (
auto& [
key, value] :
arg.items()) {
104 Computation m_computation;
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
A buffer class representing 2D matrix data.
Definition matrixBuffer.hpp:28
Base interface for all OLDB adapters.
Definition oldbIf.hpp:25
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1711
void CreateDataPoint(const DataPointPath &path)
Creates a new datapoint in the repository.
Definition repositoryIf.ipp:1696
void SetDataPoint(const DataPointPath &path, const T &value)
Sets a datapoint in the repository.
Definition repositoryIf.ipp:1720
void WriteDataPoint(const DataPointPath &path, const T &buffer)
Writes a datapoint to the repository.
Definition repositoryIf.ipp:1734
Definition rtcComponent.hpp:80
The RtctkException class is the base class for all Rtctk exceptions.
Definition exceptions.hpp:211
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Container class that holds services of any type.
Definition serviceContainer.hpp:39
void ActivityOptimising(StopToken st, const JsonPayload &arg) override
Definition businessLogic.hpp:57
void ActivityInitialising(StopToken st) override
Definition businessLogic.hpp:46
void ActivityUpdating(StopToken st, const JsonPayload &arg) override
Definition businessLogic.hpp:53
BusinessLogic(const std::string &name, ServiceContainer &services)
Definition businessLogic.hpp:32
Algorithm
Definition computation.hpp:37
Definition commandReplier.cpp:22
rad::StopToken StopToken
Definition stopToken.hpp:20
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Definition businessLogic.cpp:27
Runnable< RtcComponent > LifeCycle
Definition businessLogic.hpp:27
Header file for OldbIf, which defines the API for OldbAdapters.
Lifecycle Extension that makes an RTC Component 'Optimisable'.
Computation class of the example data task.
Lifecycle of a basic 'RtcComponent'.
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
Life cycle extension to make RtcComponent Optimisable.
Definition optimisable.hpp:128
Basic life cycle for RtcComponent.
Definition rtcComponent.hpp:74
Life cycle extension to make RtcComponent Runnable.
Definition runnable.hpp:31