ADTF
Loading...
Searching...
No Matches
configurable_runner.h
Go to the documentation of this file.
1
7#pragma once
10
11#include <map>
12#include <unordered_set>
13#include <string>
14
15namespace adtf
16{
17namespace filter
18{
20{
21
23// internal configuration interface for the Trigger (Runner)
26{
27public:
28 ADTF_IID(IInternalTriggerConfiguration, "internal_triggerconfiguration.ant.streaming.adtf.iid");
29
30public:
32 virtual adtf::base::ant::IConfiguration& GetConfiguration(tKindOfConfiguration eKind) = 0;
33
34 virtual tResult AppendDataIn(const char* strInPin) = 0;
35 virtual tResult AppendDataOut(const char* strOutPin) = 0;
36 virtual tResult AddTimerConfig(tTimeStamp tmDefaultPeriod) = 0;
37 virtual tResult AddThreadConfig(bool bCyclic) = 0;
38};
39
41// private implementation of the filter
43class cConfigurableRunner :
44 public adtf::ucom::object<ITriggerConfiguration, IInternalTriggerConfiguration, streaming::cRunner>
45{
46private:
47 cConfigurableRunner() = default;
48 std::map<uint32_t, base::ant::configuration<>> m_mapConfig;
49 util::log::ILogChannel* m_pLogChannel = nullptr;
50
51public:
52 cConfigurableRunner(const char* strName, util::log::ILogChannel* pLogChannel);
53 cConfigurableRunner(const char* strName,
54 util::log::ILogChannel* pLogChannel,
56 explicit cConfigurableRunner(const char* strName,
57 util::log::ILogChannel* pLogChannel,
59 template<typename CALLABLE>
60 cConfigurableRunner(const char* strName, util::log::ILogChannel* pLogChannel, CALLABLE&& oCallable):
61 cConfigurableRunner(strName, pLogChannel)
62 {
63 SetCallable(std::forward<CALLABLE>(oCallable));
64 }
65
66 ~cConfigurableRunner() override = default;
67
68 const base::ant::IConfiguration& GetConfiguration(tKindOfConfiguration eKind) const override;
69 base::ant::IConfiguration& GetConfiguration(tKindOfConfiguration eKind) override;
70
71 tResult AppendDataIn(const char* strInPin) override;
72 tResult AppendDataOut(const char* strOutPin) override;
73 tResult AddTimerConfig(tTimeStamp tmDefaultPeriod) override;
74 tResult AddThreadConfig(bool bCyclic) override;
75
76 tResult Run(tTimeStamp tmTimeofActivation,
78 const void* pvUserData,
79 size_t nUserDataSize) override;
80 tResult Run(base::flash::tNanoSeconds tmTimeofActivation,
82 const void* pvUserData,
83 size_t nUserDataSize) override;
84
85private:
86 template<typename VALUETYPE>
87 tResult SetProperty(ITriggerConfiguration::tKindOfConfiguration eKind, const char* strNameOfValue, VALUETYPE oValue)
88 {
90 RETURN_IF_FAILED(m_mapConfig[eKind].GetProperties(pProps));
91 return pProps->SetProperty(base::property<VALUETYPE>(strNameOfValue, oValue));
92 }
93
94 template<typename VALUETYPE>
95 VALUETYPE GetProperty(ITriggerConfiguration::tKindOfConfiguration eKind, const char* strNameOfValue)
96 {
98 m_mapConfig[eKind].GetProperties(pProps);
100 pProps->GetProperty(strNameOfValue, oValue);
101 return oValue.GetValueT();
102 }
103
104 void AddToCommaSepList(const char* strValueToAdd, adtf_util::cString& strListOfValuesCommaSep);
105};
106
107} // namespace private_implementations
108} // namespace filter
109} // namespace adtf
#define ADTF_IID(_interface, _striid)
Definition adtf_iid.h:19
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition configuration_intf.h:24
Definition runnable_intf.h:27
tActivationType
Definition runnable_intf.h:45
Definition runnable_intf.h:112
Definition properties_v2.h:283
virtual const adtf::base::ant::IConfiguration & GetConfiguration(tKindOfConfiguration eKind) const =0
tKindOfConfiguration
The kind of trigger configuration to retrieve with ITriggerConfiguration::GetConfiguration.
Definition trigger_intf.h:37
Definition trigger_intf.h:26
tKindOfConfiguration
The kind of trigger configuration to retrieve with ITriggerConfiguration::GetConfiguration.
Definition trigger_intf.h:37
Definition object_ptr.h:384
Definition object.h:397
Namespace for all internally used functionality implemented..
Definition configurable_runner.h:20
Namespace for the ADTF Filter SDK.
Definition configurable_runner.h:18
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
A timestamp with nanosecond precision.
Definition chrono.h:23