ADTF  3.18.2
thread_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, bool CYCLIC_THREAD=true>
30 class thread_triggered_filter : public triggered_filter < TriggerFunctionImpl >
31 {
32 
33 protected:
36 
37 public:
38 
40  ADTF3_DEPRECATED("Class 'thread_triggered_filter' is deprecated, as well as macro 'ADTF_THREAD_TRIGGERED_FILTER'."
41  "Use class 'filter_with_trigger_function' or macros 'ADTF_TRIGGER_FUNCTION_FILTER' / 'ADTF_TRIGGER_FUNCTION_FILTER_PLUGIN' instead.")
43  {
44  }
45 
48  {
49  }
50 
51 protected:
52  tResult CreateDefaultTrigger(const char* strFunctionName) override
53  {
54  using namespace adtf::base;
55  bool bCyclic = CYCLIC_THREAD;
56  RETURN_IF_FAILED(base_type::ConfigureThreadTrigger(strFunctionName, bCyclic));
58  }
59 
60 };
61 
62 } //namespace ant
63 
64 namespace detail
65 {
66 
67 template<typename FilterClass>
68 tResult thread_trigger(FilterClass& oFilter, bool bCyclic)
69 {
70  return oFilter.ConfigureThreadTrigger(oFilter.GetTriggerFunctionName(),
71  bCyclic);
72 }
73 
74 }
75 
76 namespace devil
77 {
78 
79 inline std::function<tResult(cFilterWithTriggerFunction&)> thread_trigger(bool bCyclic)
80 {
81  return std::bind(detail::thread_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, bCyclic);
82 }
83 
84 } //namespace devil
85 
86 namespace hollow
87 {
88 
89 inline std::function<tResult(cFilterWithTriggerFunction&)> thread_trigger(bool bCyclic)
90 {
91  return std::bind(detail::thread_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, bCyclic);
92 }
93 
94 } //namespace devil
95 
96 
97 using ant::thread_triggered_filter;
98 using hollow::thread_trigger;
99 
100 } //namespace filter
101 } //namespace adtf
102 
116 #define ADTF_THREAD_TRIGGERED_FILTER_NAME(_class_identifier_, \
117  _class_name_, \
118  _threadtriggerfilterclass_,\
119  _triggerfunction_, \
120  _thread_cyclic_,\
121  ...) \
122  ADTF_TRIGGERED_FILTER_NAME(_class_identifier_,\
123  _class_name_,\
124  _threadtriggerfilterclass_,\
125  _triggerfunction_,\
126  adtf::filter::thread_trigger(_thread_cyclic_))
127 
140 #define ADTF_THREAD_TRIGGERED_FILTER(_class_identifier_, \
141  _threadtriggerfilterclass_,\
142  _triggerfunction_, \
143  _thread_cyclic_) \
144  ADTF_THREAD_TRIGGERED_FILTER_NAME(_class_identifier_,\
145  _class_identifier_,\
146  _threadtriggerfilterclass_,\
147  _triggerfunction_,\
148  _thread_cyclic_)
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 ConfigureThreadTrigger(const char *strRunnerName, bool bCallCyclic)
Creates an internal a internal thread configuration for a timing trigger.
triggered_filter< TriggerFunctionImpl > base_type
base type of thread_triggered_filter
ADTF3_DEPRECATED("Class 'thread_triggered_filter' is deprecated, as well as macro 'ADTF_THREAD_TRIGGERED_FILTER'." "Use class 'filter_with_trigger_function' or macros 'ADTF_TRIGGER_FUNCTION_FILTER' / 'ADTF_TRIGGER_FUNCTION_FILTER_PLUGIN' instead.") thread_triggered_filter()
CTOR.
Simple Filter for Registering One Triggerfunction to a filter.
Namespace for the ADTF Base SDK.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.