ADTF  3.18.2
data_triggered_filter.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "triggered_filter.h"
9 
10 #include <adtf_base_deprecated.h>
11 
12 namespace adtf
13 {
14 namespace filter
15 {
16 namespace ant
17 {
18 
29 template<typename TriggerFunctionImpl, typename InPinListOfTriggers>
30 class data_triggered_filter : public triggered_filter < TriggerFunctionImpl >
31 {
32 protected:
35 
36 public:
37 
39  ADTF3_DEPRECATED("Class 'data_triggered_filter' is deprecated, as well as macro 'ADTF_DATA_TRIGGERED_FILTER'."
40  "Use class filter_with_trigger_function or macros 'ADTF_TRIGGER_FUNCTION_FILTER' / 'ADTF_TRIGGER_FUNCTION_FILTER_PLUGIN' instead.")
42  {
43  }
44 
47  {
48  }
49 
50  tResult CreateDefaultTrigger(const char* strFunctionName) override
51  {
52  adtf_util::cStringList strPinList = adtf_util::cStringList(InPinListOfTriggers::GetPinTriggerList());
53  for (adtf_util::cStringList::iterator it = strPinList.begin();
54  it != strPinList.end();
55  it++)
56  {
57  (*it).Trim();
59  }
61  }
62 };
63 
64 } //namespace ant
65 
66 namespace detail
67 {
68 
69 template<typename FilterClass>
70 tResult pin_trigger(FilterClass& oFilter, const std::vector<util::cString>& oTriggerPins)
71 {
72  for (util::cString strTriggerPin: oTriggerPins)
73  {
74  strTriggerPin.Trim();
75  RETURN_IF_FAILED(oFilter.ConfigureDataInTrigger(oFilter.GetTriggerFunctionName(), strTriggerPin));
76  }
78 }
79 
80 }
81 
82 namespace devil
83 {
84 
85 inline std::function<tResult(cFilterWithTriggerFunction&)> pin_trigger(std::vector<util::cString> oTriggerPins)
86 {
87  return std::bind(detail::pin_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, oTriggerPins);
88 }
89 
90 } //namespace devil
91 
92 namespace hollow
93 {
94 
95 inline std::function<tResult(cFilterWithTriggerFunction&)> pin_trigger(std::vector<util::cString> oTriggerPins)
96 {
97  return std::bind(detail::pin_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, oTriggerPins);
98 }
99 
100 } //namespace devil
101 
102 using ant::data_triggered_filter;
103 using hollow::pin_trigger;
104 
105 } //namespace filter
106 } //namespace adtf
107 
115 #define ADTF_DATA_TRIGGERED_PIN_LIST(_triggerlistclass_, _listcommaseparated_) \
116 struct _triggerlistclass_ \
117 { \
118  static adtf_util::cStringList GetPinTriggerList() \
119  { \
120  return adtf_util::cStringList(_listcommaseparated_); \
121  } \
122 }
123 
138 #define ADTF_DATA_TRIGGERED_FILTER_NAME(_class_identifier_, \
139  _class_name_, \
140  _datatriggerfilterclass_, \
141  _triggerfunction_, \
142  _triggerlistclass_, \
143  ...) \
144 class _datatriggerfilterclass_ : public adtf::filter::data_triggered_filter<_triggerfunction_, _triggerlistclass_> \
145 { \
146  public:\
147  ADTF_CLASS_ID_NAME(_datatriggerfilterclass_, _class_identifier_, _class_name_); \
148  __VA_ARGS__;\
149  public: \
150  _datatriggerfilterclass_() = default; \
151  virtual ~_datatriggerfilterclass_() = default; \
152 }
153 
167 #define ADTF_DATA_TRIGGERED_FILTER(_class_identifier_, \
168  _datatriggerfilterclass_, \
169  _triggerfunction_, \
170  _triggerlistclass_)\
171  ADTF_DATA_TRIGGERED_FILTER_NAME(_class_identifier_, \
172  _class_identifier_, \
173  _datatriggerfilterclass_, \
174  _triggerfunction_, \
175  _triggerlistclass_)
176 
Copyright © Audi Electronics Venture GmbH.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
tResult ConfigureDataInTrigger(const char *strRunnerName, const char *strPinName)
Creates an internal trigger pipe for the given pin.
triggered_filter< TriggerFunctionImpl > base_type
base type definition
ADTF3_DEPRECATED("Class 'data_triggered_filter' is deprecated, as well as macro 'ADTF_DATA_TRIGGERED_FILTER'." "Use class filter_with_trigger_function or macros 'ADTF_TRIGGER_FUNCTION_FILTER' / 'ADTF_TRIGGER_FUNCTION_FILTER_PLUGIN' instead.") data_triggered_filter()
CTOR.
Simple Filter for Registering One Triggerfunction to a filter.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
Definition: string.h:2778
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.