RTC Toolkit 5.1.0
Loading...
Searching...
No Matches
businessLogic.hpp
Go to the documentation of this file.
1
12#ifndef RTCTK_TELSUB_BUSINESSLOGIC_HPP
13#define RTCTK_TELSUB_BUSINESSLOGIC_HPP
14#include <functional>
15#include <iosfwd>
16#include <memory>
17
25
27#include <vector>
28
29namespace rtctk::telSub {
30
39std::ostream& operator<<(std::ostream& stream, const std::vector<std::string>& data);
40
56
58
66public:
68
70 std::function<std::unique_ptr<OperationalLogicIf>(const OperationalLogicFactoryParams&)>;
71 BusinessLogic(const std::string& name,
74
85 void ActionClearAlerts() override;
86
87protected:
88 log4cplus::Logger& m_logger;
89 std::string m_name;
90
94 template <typename T>
96 using namespace rtctk::componentFramework;
97 auto fullpath = ""_dppath / DataPointPath(m_name) / path;
98 value = m_rtr.GetDataPoint<T>(fullpath);
99 LOG4CPLUS_INFO(m_logger, " - " << fullpath << ": " << value);
100 }
101
107 template <typename T>
109 using namespace rtctk::componentFramework;
110 DataPointPath fullpath = ""_dppath / DataPointPath(m_name) / path;
112 if (loaded) {
113 LOG4CPLUS_INFO(m_logger, " - " << fullpath << ": " << value);
114 }
115 return loaded;
116 }
117
118 std::vector<DataPointPath> GetTopicPaths() {
119 using namespace rtctk::componentFramework;
120 DataPointPath fullpath = ""_dppath / DataPointPath(m_name) / "static/dds_topics"_dppath;
122 return children;
123 }
124
128 std::optional<numapp::NumaPolicies>
130
132
134
136
139 std::unique_ptr<OperationalLogicIf> m_operational_logic;
140};
141
142} // namespace rtctk::telSub
143
144#endif // RTCTK_TELSUB_BUSINESSLOGIC_HPP
Declares AlertService.
Alert Service interface.
Definition alertServiceIf.hpp:138
Component metrics interface.
Definition componentMetricsIf.hpp:85
This class provides a wrapper for a data point path.
Definition dataPointPath.hpp:74
T GetDataPoint(const DataPointPath &path) const
Fetches a datapoint from the repository.
Definition repositoryIf.ipp:1711
std::pair< PathList, PathList > GetChildren(const DataPointPath &path, bool recurse=false) const
Queries the child datapoints and paths for a given parent path.
Definition repositoryIf.cpp:470
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Container class that holds services of any type.
Definition serviceContainer.hpp:39
Implements the Telemetry Subscriber business logic.
Definition businessLogic.hpp:65
std::function< std::unique_ptr< OperationalLogicIf >(const OperationalLogicFactoryParams &)> OperationalLogicFactory
Definition businessLogic.hpp:69
std::vector< DataPointPath > GetTopicPaths()
Definition businessLogic.hpp:118
BusinessLogic(const std::string &name, componentFramework::ServiceContainer &services, OperationalLogicFactory factory)
Definition businessLogic.cpp:41
rtctk::componentFramework::AlertServiceIf & m_alerts
Definition businessLogic.hpp:135
bool GuardUpdatingAllowed(const componentFramework::JsonPayload &args) override
Definition businessLogic.cpp:214
void ActivityGoingRunning(componentFramework::StopToken st) override
Main tasks:
Definition businessLogic.cpp:179
std::unique_ptr< OperationalLogicIf > m_operational_logic
Operational logic constructed during Initialization with parameters from configuration.
Definition businessLogic.hpp:139
void ActivityStarting(componentFramework::StopToken st) override
Deletes the operational logic if the object exists.
Definition businessLogic.cpp:62
void ActionClearAlerts() override
Definition businessLogic.cpp:219
void GetParam(const rtctk::componentFramework::DataPointPath &path, T &value)
Helper method to fetch and log datapoint values loaded from the Runtime Repository.
Definition businessLogic.hpp:95
void ActivityGoingIdle(componentFramework::StopToken st) override
Main tasks:
Definition businessLogic.cpp:189
void ActivityInitialising(componentFramework::StopToken st) override
Main tasks:
Definition businessLogic.cpp:75
rtctk::componentFramework::RuntimeRepoIf & m_rtr
Definition businessLogic.hpp:131
log4cplus::Logger & m_logger
Definition businessLogic.hpp:88
bool GetOptionalParam(const rtctk::componentFramework::DataPointPath &path, T &value)
Helper method similar to GetParam, except no exceptions are thrown if the path does not exit and the ...
Definition businessLogic.hpp:108
void ActivityEnabling(componentFramework::StopToken st) override
Main tasks:
Definition businessLogic.cpp:161
void ActivityRunning(componentFramework::StopToken st) override
TBC if we have anything to do here.
Definition businessLogic.cpp:197
rtctk::componentFramework::ComponentMetricsIf & m_metrics
Definition businessLogic.hpp:133
void ActivityDisabling(componentFramework::StopToken st) override
Main tasks:
Definition businessLogic.cpp:171
void ActivityUpdating(componentFramework::StopToken st, const componentFramework::JsonPayload &args) override
TBD what, if anything can be updated? I can't think of anything that does not require reinitializatio...
Definition businessLogic.cpp:209
OperationalLogicFactory m_operational_logic_factory
Definition businessLogic.hpp:137
std::optional< numapp::NumaPolicies > LoadNumaPolicies(const rtctk::componentFramework::DataPointPath &path)
Helper method that builds full path and logs loaded configuration.
Definition businessLogic.cpp:224
std::string m_name
Definition businessLogic.hpp:89
Header file for DataPointPath.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
rad::StopToken StopToken
Definition stopToken.hpp:20
bool GetOptionalParam(RepositoryIf &repo, const DataPointPath &path, T &value)
Get optional datapoint.
Definition repositoryIfUtils.hpp:40
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
std::ostream & operator<<(std::ostream &out, const DataPointPath &rhs)
Definition dataPointPath.hpp:440
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Definition main.cpp:24
rtctk::componentFramework::Runnable< rtctk::componentFramework::RtcComponent > LifeCycle
Definition businessLogic.hpp:57
Declares OperationalLogic.
Provides utilities to simplify use of RepositoryIf.
Lifecycle Extension that makes an RTC Component 'Runnable'.
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
A container that can hold any type of service.
Life cycle extension to make RtcComponent Runnable.
Definition runnable.hpp:31
Placeholder for correlator parameters.
Definition correlatorIf.hpp:45
Parameter set to be passed to classes deriving from DdsWaitSetIf.
Definition ddsWaitSetIf.hpp:52
Set of all parameters needed when constructing the OperationalLogic object.
Definition businessLogic.hpp:50
DdsParams dds_params
Definition businessLogic.hpp:52
ShmParams shm_params
Definition businessLogic.hpp:51
OperationalParams operational_params
Definition businessLogic.hpp:54
CorrelatorParams correlator_params
Definition businessLogic.hpp:53
Configuration parameters needed for operational logic.
Definition operationalLogicIf.hpp:55
Shared memory configuration parameters.
Definition operationalLogicIf.hpp:37