ADTF  3.18.2
time_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, tTimeStamp DEFAULT_PERIOD >
30 class time_triggered_filter : public triggered_filter < TriggerFunctionImpl >
31 {
32 
33 protected:
35 
36 public:
37 
38  ADTF3_DEPRECATED("Class 'time_triggered_filter' is deprecated, as well as macro 'ADTF_TIME_TRIGGERED_FILTER'."
39  "Use class 'filter_with_trigger_function' or macros 'ADTF_TRIGGER_FUNCTION_FILTER' / 'ADTF_TRIGGER_FUNCTION_FILTER_PLUGIN' instead.")
41  {
42  }
43 
44 
46  {
47  }
48 
49 protected:
50  tResult CreateDefaultTrigger(const char* strFunctionName) override
51  {
52  using namespace adtf::base;
53  tTimeStamp tmCurrentPeriod = DEFAULT_PERIOD;
54  RETURN_IF_FAILED(base_type::ConfigureTimerTrigger(strFunctionName, tmCurrentPeriod));
56  }
57 };
58 
59 } //namespace ant
60 
61 namespace detail
62 {
63 
64 template<typename FilterClass>
65 tResult timer_trigger(FilterClass& oFilter, tTimeStamp tmDefaultInterval)
66 {
67  return oFilter.ConfigureTimerTrigger(oFilter.GetTriggerFunctionName(),
68  tmDefaultInterval);
69 }
70 
71 }
72 
73 namespace devil
74 {
75 
76 inline std::function<tResult(cFilterWithTriggerFunction&)> timer_trigger(tTimeStamp tmDefaultInterval)
77 {
78  return std::bind(detail::timer_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, tmDefaultInterval);
79 }
80 
81 } //namespace devil
82 
83 namespace hollow
84 {
85 
86 inline std::function<tResult(cFilterWithTriggerFunction&)> timer_trigger(tTimeStamp tmDefaultInterval)
87 {
88  return std::bind(detail::timer_trigger<cFilterWithTriggerFunction>, std::placeholders::_1, tmDefaultInterval);
89 }
90 
91 } //namespace devil
92 
93 using ant::time_triggered_filter;
94 using hollow::timer_trigger;
95 
108 #define ADTF_TIME_TRIGGERED_FILTER_NAME(_class_identifier_,\
109  _class_name_,\
110  _timetriggerfilterclass_,\
111  _triggerfunction_,\
112  _time_period_micro_sec_,\
113  ...) \
114  ADTF_TRIGGER_FUNCTION_FILTER(_class_identifier_,\
115  _class_name_,\
116  _timetriggerfilterclass_,\
117  _triggerfunction_,\
118  adtf::filter::timer_trigger(_time_period_micro_sec_),\
119  __VA_ARGS__)
120 
132 #define ADTF_TIME_TRIGGERED_FILTER(_class_identifier_,\
133  _timetriggerfilterclass_,\
134  _triggerfunction_,\
135  _time_period_micro_sec_) \
136  ADTF_TIME_TRIGGERED_FILTER_NAME(_class_identifier_,\
137  _class_identifier_,\
138  _timetriggerfilterclass_,\
139  _triggerfunction_,\
140  _time_period_micro_sec_)
141 
142 } //namespace filter
143 } //namespace adtf
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 ConfigureTimerTrigger(const char *strRunnerName, tTimeStamp tmPeriod)
Creates an internal a internal trigger configuration for a timing trigger.
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.