ADTF  3.18.2
streaming3/include/adtfstreaming3/runner.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "triggerpipe.h"
10 #include "runner_intf.h"
11 #include "reference_clock_intf.h"
12 
13 #include <adtfucom3/adtf_ucom3.h>
14 
15 namespace adtf
16 {
17 namespace streaming
18 {
19 namespace ant
20 {
24  class cRunner: public named_graph_object<trigger_pipe_item<IRunner>>
25  {
26  private:
28  std::shared_ptr<base::runnable<base::IRunnable::RUN_TRIGGER>> m_pInternalRunnable;
29 
30  public:
32  cRunner() = default;
35  cRunner(const char* strName)
36  {
37  SetName(strName);
38  }
42  cRunner(const char* strName, base::IRunnable& oRunnable): cRunner(strName)
43  {
44  SetRunnable(oRunnable);
45  }
46 
50  cRunner(const char* strName, base::IRunnable::tRunFunction oRunFunc): cRunner(strName)
51  {
52  m_pInternalRunnable.reset(new base::runnable<base::IRunnable::RUN_TRIGGER>(oRunFunc));
53  trigger_pipe_item::SetRunnable(*m_pInternalRunnable.get());
54  }
63  {
65  if (m_pInternalRunnable)
66  {
67  m_pInternalRunnable.reset();
68  }
69  }
70 
71  tResult SetName(const char* strName) override
72  {
74  return SetFullName(get_named_graph_object_full_name(*this));
75  }
76 
77  tResult SetParent(const ucom::ant::IObject* oParentObject) override
78  {
79  RETURN_IF_FAILED(base_type::SetParent(oParentObject));
80  return SetFullName(get_named_graph_object_full_name(*this));
81  }
82  };
83 
84 } //namespace ant
85 
86 namespace flash
87 {
88 
92 class cRunner: public ucom::catwo::object<base::ant::IRunnable,
93  ant::ITriggerPipeSource,
94  ant::ITriggerPipeItem,
95  ant::INamedGraphObject,
96  ant::IRunner,
97  base::flash::IRunnable>
98 {
99  public:
102 
104  ~cRunner() override;
105 
108  cRunner(const char* strName);
109 
113  cRunner(const char* strName, base::flash::IRunnable& oRunnable);
114 
118  cRunner(const char* strName, base::ant::IRunnable& oRunnable);
119 
123  cRunner(const char* strName, base::flash::IRunnable::tRunFunction oRunFunc);
124 
128  cRunner(const char* strName, base::ant::IRunnable::tRunFunction oRunFunc);
129 
130  void SetRunnable(base::flash::IRunnable& oRunnable);
131  void SetRunnable(base::ant::IRunnable& oRunnable);
132 
133  void SetRunnable(base::flash::IRunnable::tRunFunction oRunFunc);
134  void SetRunnable(base::ant::IRunnable::tRunFunction oRunFunc);
135 
136  ADTF_FLASH_TRIGGER_PIPE_ITEM_METHOD_DECLARATIONS
137 
138  protected:
139  class cImplementation;
140  std::unique_ptr<cImplementation> m_pImplementation;
141 };
142 
143 }
144 
145 namespace lucky
146 {
147 
154  public ucom::catwo::object<ucom::ant::cClassInfo,
155  ant::INamedGraphObject,
156  ant::ITriggerPipeSource,
157  ant::IActiveRunner,
158  base::ant::configuration<>>
159 {
160  public:
165 
169  ~cActiveRunner() override;
170 
171 
172  tResult GetName(base::ant::IString&& strName) const override;
173  tResult SetName(const char* strName) override;
174  tResult SetParent(const ucom::ant::IObject* pParentObject) override;
175  tResult GetParent(const ucom::ant::IObject*& pParentObject) const override;
176 
177  tResult RegisterSubItem(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun,
178  tPriority ui32Prio) override;
179  tResult UnregisterSubItem(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun) override;
180  tResult ChangePriority(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun,
181  tPriority ui32Prio) override;
182  tResult GetSubItems(adtf::ucom::ant::iobject_enum<const ITriggerPipeItem>& lstSubItems) const override;
183 
184  protected:
192  void Trigger(base::flash::tNanoSeconds tmTimeOfTrigger);
193 
200  void Trigger();
201 
202  protected:
203  class cImplementation;
204  std::unique_ptr<cImplementation> m_pImplementation;
205 };
206 
207 }
208 
209 namespace quiet
210 {
211 
215 class cRunner: public ucom::catwo::object<flash::cRunner,
216  ITriggerPipeHierachy>
217 {
218  public:
221 
223  ~cRunner() override;
224 
227  cRunner(const char* strName);
228 
232  cRunner(const char* strName, base::flash::IRunnable& oRunnable);
233 
237  cRunner(const char* strName, base::ant::IRunnable& oRunnable);
238 
242  cRunner(const char* strName, base::flash::IRunnable::tRunFunction oRunFunc);
243 
247  cRunner(const char* strName, base::ant::IRunnable::tRunFunction oRunFunc);
248 
249  ADTF_QUIET_TRIGGER_PIPE_ITEM_METHOD_DECLARATIONS
250 };
251 
252 }
253 
254 namespace spider
255 {
256 
262  public ucom::catwo::object<ucom::ant::cClassInfo,
263  ant::INamedGraphObject,
264  ant::ITriggerPipeSource,
265  ant::IActiveRunner,
266  spider::IActiveRunner,
267  base::ant::configuration<>>
268 {
269  public:
274 
278  ~cActiveRunner() override;
279 
280 
281  tResult GetName(base::ant::IString&& strName) const override;
282  tResult SetName(const char* strName) override;
283  tResult SetParent(const ucom::ant::IObject* pParentObject) override;
284  tResult GetParent(const ucom::ant::IObject*& pParentObject) const override;
285 
286  tResult RegisterSubItem(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun,
287  tPriority ui32Prio) override;
288  tResult UnregisterSubItem(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun) override;
289  tResult ChangePriority(const adtf::ucom::ant::iobject_ptr<ITriggerPipeItem>& pSubRun,
290  tPriority ui32Prio) override;
291  tResult GetSubItems(adtf::ucom::ant::iobject_enum<const ITriggerPipeItem>& lstSubItems) const override;
292 
293  tResult WaitForDeactivation() override
294  {
296  }
297 
298  protected:
306  void Trigger(base::flash::tNanoSeconds tmTimeOfTrigger);
307 
314  void Trigger();
315 
316  protected:
317  class cImplementation;
318  std::unique_ptr<cImplementation> m_pImplementation;
319 };
320 
321 }
322 
324 using quiet::cRunner;
327 
328 } //namespace streaming
329 } //namespace adtf
Copyright © Audi Electronics Venture GmbH.
#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.
The Runnable interface defines common methods for a running component.
Definition: runnable_intf.h:26
std::function< tResult(tTimeStamp)> tRunFunction
Type defintion of the function used to implement Run.
Definition: runnable_intf.h:37
The IString interface provides methods for getting and setting strings through abstract interfaces.
Definition: string_intf.h:28
std::function< tResult(tNanoSeconds)> tRunFunction
Type defintion of the function used to implement Run.
Default and simple Runner implementation.
void SetRunnable(adtf::base::ant::IRunnable &oRunnable)
Sets the Runnable implementation to call if Run is called.
cRunner(const char *strName, base::IRunnable::tRunFunction oRunFunc)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName)
CTOR to set a name.
cRunner(const char *strName, base::IRunnable &oRunnable)
CTOR to set a name and initialize with a Runnable instance immediatelly.
Default convenient implementation for INamedGraphObject.
tResult SetName(const char *strName) override
Sets the Name of the object.
tResult SetParent(const ucom::ant::IObject *poParentObject) override
Sets Parent of the object.
void SetRunnable(adtf::base::ant::IRunnable &oRunnable)
Sets the Runnable implementation to call if Run is called.
Definition: triggerpipe.h:225
Default and simple Runner implementation.
cRunner(const char *strName, base::ant::IRunnable &oRunnable)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName, base::flash::IRunnable::tRunFunction oRunFunc)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName, base::ant::IRunnable::tRunFunction oRunFunc)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName)
CTOR to set a name.
cRunner(const char *strName, base::flash::IRunnable &oRunnable)
CTOR to set a name and initialize with a Runnable instance immediatelly.
void Trigger(base::flash::tNanoSeconds tmTimeOfTrigger)
This method will trigger all registered trigger pipe items.
~cActiveRunner() override
Destructor.
void Trigger()
This method will trigger all registered trigger pipe items.
Default and simple Runner implementation.
cRunner(const char *strName, base::ant::IRunnable &oRunnable)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName, base::flash::IRunnable::tRunFunction oRunFunc)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName, base::ant::IRunnable::tRunFunction oRunFunc)
CTOR to set a name and initialize with a Runnable instance immediatelly.
cRunner(const char *strName)
CTOR to set a name.
cRunner(const char *strName, base::flash::IRunnable &oRunnable)
CTOR to set a name and initialize with a Runnable instance immediatelly.
void Trigger(base::flash::tNanoSeconds tmTimeOfTrigger)
This method will trigger all registered trigger pipe items.
~cActiveRunner() override
Destructor.
void Trigger()
This method will trigger all registered trigger pipe items.
Base class for every interface type within the uCOM.
Definition: object_intf.h:31
Interface definition for a container of objects.
Definition: object_list.h:22
Base object pointer to realize binary compatible reference counting in interface methods.
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Definition: object.h:379
adtf_util::cString get_named_graph_object_full_name(const INamedGraphObject &oGraphObject)
Helper function to retrieve a full qualified unique name of an object registered in IFilterGraph.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.