ADTF  3.18.2
triggerpipe.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "triggerpipe_intf.h"
10 #include "named_graph_object.h"
11 #include "graph.h"
12 
13 #include <adtfbase/runnable_intf.h>
15 
16 namespace adtf
17 {
18 namespace streaming
19 {
20 namespace ant
21 {
22  namespace detail
23  {
28  {
29  private:
32 
33  public:
37  virtual ~cTriggerPipeSourceImpl() = default;
38 
39  private:
48 
49  protected:
52 
53  public:
64 
75  tResult RunSubs(tTimeStamp tmTimeofActivation,
77  const void* pvUserData,
78  size_t nUserDataSize);
79 
80  tResult RunSubs(base::flash::tNanoSeconds tmTimeofActivation,
82  const void* pvUserData,
83  size_t nUserDataSize);
84  };
85  } //detail
86 
93  template <typename INTERFACE = ITriggerPipeSource>
94  class trigger_pipe_source: public adtf::ucom::catwo::object<ITriggerPipeSource, INTERFACE>,
96  {
97  public:
99  trigger_pipe_source() = default;
100 
102  virtual ~trigger_pipe_source() = default;
103 
104  public: //implements ITriggerPipeSource
107  ITriggerPipeItem::tPriority ui32Prio) override
108  {
109  #ifdef _DEBUG
110  INamedGraphObject* pNamedFar = adtf::ucom::ant::ucom_cast<INamedGraphObject*>(pSubRun.Get());
111  INamedGraphObject* pNamedThis = adtf::ucom::ucom_cast<INamedGraphObject*>(this);
112  adtf_util::cString strFullNameTo("unkonwn");
113  if (pNamedFar)
114  {
115  strFullNameTo = get_named_graph_object_full_name(*pNamedFar);
116  }
117  adtf_util::cString strFullName("unkonwn");
118  if (pNamedThis)
119  {
120  strFullName = get_named_graph_object_full_name(*pNamedThis);
121  }
122  LOG_DUMP("Runner connecting: %s -> %s", strFullName.GetPtr(), strFullNameTo.GetPtr());
123  #endif //_DEBUG
125  return detail::cTriggerPipeSourceImpl::RegisterSubItem(pSubRun, ui32Prio);
126  }
129  {
131  }
134  ITriggerPipeItem::tPriority ui32Prio) override
135  {
136  return detail::cTriggerPipeSourceImpl::ChangePriority(pSubRun, ui32Prio);
137  }
140  {
142  }
143 
144  };
145 
146 
153  template <typename INTERFACE = ITriggerPipeItem>
154  class trigger_pipe_item : public adtf::ucom::catwo::object<ITriggerPipeItem, trigger_pipe_source<INTERFACE>>
155  {
156  public:
159 
160  private:
165 
166  public:
168  trigger_pipe_item() = default;
171  trigger_pipe_item(const char* strName) : _base_type(strName)
172  {
173  }
177  trigger_pipe_item(const char* strName, adtf::base::ant::IRunnable& oRunnable) : trigger_pipe_item(strName)
178  {
179  SetRunnable(oRunnable);
180  }
181 
182  tResult SetFullName(const char* strName)
183  {
184  m_pErrorHandler = adtf::base::elasto::create_error_handler(strName,
185  "runner_pipe_error",
188  }
189 
202  tResult Run(tTimeStamp tmTimeofActivation,
204  const void* pvUserData,
205  size_t nUserDataSize) override
206  {
207  //ask for return value ??? and what to to with that ?
208  //if somebody return an error this will break the whole runnerpipe
209  auto oResult = m_pRunnable->Run(tmTimeofActivation, ui32ActivationType, pvUserData, nUserDataSize);
210  if (IS_FAILED(oResult) && m_pErrorHandler)
211  {
212  m_pErrorHandler->Handle(oResult);
213  }
214  return detail::cTriggerPipeSourceImpl::RunSubs(tmTimeofActivation, ui32ActivationType, pvUserData, nUserDataSize);
215  }
216 
217  public:
226  {
227  m_pRunnable = &oRunnable;
228  }
229  };
230 
243  tResult create_trigger_pipe(const char* strNameOfPipe,
246 
255 
256 } //namespace ant
257 
258 namespace flash
259 {
260 
261 #define ADTF_FLASH_NAMED_GRAPH_OBJECT_METHOD_DECLARATIONS \
262 public:\
263  tResult GetName(base::ant::IString&& strName) const override;\
264  tResult SetName(const char* strName) override;\
265  tResult SetParent(const ucom::ant::IObject* oParentObject) override;\
266  tResult GetParent(const ucom::ant::IObject*& poParentObject) const override;
267 
268 #define ADTF_FLASH_TRIGGER_PIPE_SOURCE_METHOD_DECLARATIONS \
269 public:\
270  tResult RegisterSubItem(const ucom::ant::iobject_ptr<streaming::ant::ITriggerPipeItem>& pSubRun,\
271  streaming::ant::ITriggerPipeSource::tPriority ui32Prio) override;\
272  tResult UnregisterSubItem(const ucom::ant::iobject_ptr<streaming::ant::ITriggerPipeItem>& pSubRun) override;\
273  tResult ChangePriority(const ucom::ant::iobject_ptr<streaming::ant::ITriggerPipeItem>& pSubRun,\
274  streaming::ant::ITriggerPipeSource::tPriority ui32Prio) override;\
275  tResult GetSubItems(ucom::ant::iobject_enum<const streaming::ant::ITriggerPipeItem>& lstSubItems) const override;
276 
277 #define ADTF_FLASH_TRIGGER_PIPE_ITEM_METHOD_DECLARATIONS \
278 public:\
279  tResult Run(tTimeStamp tmTimeofActivation,\
280  base::ant::IRunnable::tActivationType ui32ActivationType,\
281  const void* pvUserData,\
282  size_t nUserDataSize) override;\
283  tResult Run(base::flash::tNanoSeconds tmTimeofActivation,\
284  base::ant::IRunnable::tActivationType ui32ActivationType,\
285  const void* pvUserData,\
286  size_t nUserDataSize) override;\
287 public:\
288  ADTF_FLASH_TRIGGER_PIPE_SOURCE_METHOD_DECLARATIONS \
289  ADTF_FLASH_NAMED_GRAPH_OBJECT_METHOD_DECLARATIONS
290 
291 }
292 
293 namespace quiet
294 {
295 
296 #define ADTF_QUIET_TRIGGER_PIPE_ITEM_METHOD_DECLARATIONS \
297 public:\
298  tResult RegisterTriggerParent(const streaming::ant::ITriggerPipeSource* pParent) override;\
299  tResult UnregisterTriggerParent(const streaming::ant::ITriggerPipeSource* pParent) override;\
300  tResult GetTriggerParents(const ucom::nitro::ifunction<tResult(const streaming::ant::ITriggerPipeSource*)>& fnCallback) const override;
301 }
302 
304 using ant::trigger_pipe_source;
306 using ant::trigger_pipe_item;
307 
310 } //namespace streaming
311 } //namespace adtf
#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
virtual tResult Run(tTimeStamp tmTimeofActivation, tActivationType ui32ActivationType, const void *pvUserData, size_t nUserDataSize)=0
The Run method to set the component in running state.
tActivationType
Enumeration of the possible activation types to set a component in running state.
Definition: runnable_intf.h:44
virtual void Handle(tResult oError)=0
Call this to notify the error handling of an error that occured.
@ Stop
log error and stop the session.
Interface for a NamedGraphObject which can be added to the FilterGraph.
Interface that defines a TriggerPipeSource, which is able to send a Run (RUN::TIrgger) call to the re...
tPriority
Priority used for the order of ITriggerPipeItem::Run calls.
Default implementation for a ITriggerPipeSource.
Definition: triggerpipe.h:28
cTriggerPipeSourceImpl(const cTriggerPipeSourceImpl &)=delete
deleted copy CTOR
cTriggerPipeSourceImpl & operator=(cTriggerPipeSourceImpl &&)=delete
deleted move operator
cTriggerPipeSourceImpl & operator=(const cTriggerPipeSourceImpl &)=delete
deleted copy operator
tResult GetSubItems(adtf::ucom::ant::iobject_enum< const ITriggerPipeItem > &lstSubItems) const
Retrieves a list of the registered Items.
tResult RegisterSubItem(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun, ITriggerPipeItem::tPriority ui32Prio)
Registers the pSubRun as SubItem of the source.
static adtf::base::IRunnable * m_pNothingToDoRunnable
internal runnable implementation to prevent nullpointer checks
Definition: triggerpipe.h:51
A_UTILS_D(cTriggerPipeSourceImpl)
private dpointer
cTriggerPipeSourceImpl(cTriggerPipeSourceImpl &&)=delete
deleted move CTOR
tResult ChangePriority(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun, ITriggerPipeItem::tPriority ui32Prio)
Changes the priority of the pSubRun.
tResult RunSubs(tTimeStamp tmTimeofActivation, adtf::base::ant::IRunnable::tActivationType ui32ActivationType, const void *pvUserData, size_t nUserDataSize)
Then the Registered subitems will be called in order of ITriggerPipeItem::tPriority.
tResult UnregisterSubItem(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun)
Unregisters the pSubRun from the source.
Default implementation class template for a ITriggerPipeItem.
Definition: triggerpipe.h:155
trigger_pipe_source< INTERFACE > _base_type
used base type derived from
Definition: triggerpipe.h:158
void SetRunnable(adtf::base::ant::IRunnable &oRunnable)
Sets the Runnable implementation to call if Run is called.
Definition: triggerpipe.h:225
trigger_pipe_item(const char *strName, adtf::base::ant::IRunnable &oRunnable)
CTOR further initializer.
Definition: triggerpipe.h:177
adtf::base::ant::IRunnable * m_pRunnable
Nothing to do runnable.
Definition: triggerpipe.h:163
trigger_pipe_item(const char *strName)
CTOR with name.
Definition: triggerpipe.h:171
tResult Run(tTimeStamp tmTimeofActivation, adtf::base::ant::IRunnable::tActivationType ui32ActivationType, const void *pvUserData, size_t nUserDataSize) override
This method will be called to activate the registered m_pRunnable by a given activation type.
Definition: triggerpipe.h:202
Default implementation class template for a ITriggerPipeSource.
Definition: triggerpipe.h:96
tResult RegisterSubItem(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun, ITriggerPipeItem::tPriority ui32Prio) override
Registers the pSubRun as SubItem of the source.
Definition: triggerpipe.h:106
tResult GetSubItems(adtf::ucom::ant::iobject_enum< const ITriggerPipeItem > &lstSubItems) const override
Retrieves a list of the registered Items.
Definition: triggerpipe.h:139
tResult UnregisterSubItem(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun) override
Unregisters the pSubRun from the source.
Definition: triggerpipe.h:128
tResult ChangePriority(const adtf::ucom::ant::iobject_ptr< ITriggerPipeItem > &pSubRun, ITriggerPipeItem::tPriority ui32Prio) override
Changes the priority of the pSubRun.
Definition: triggerpipe.h:133
virtual ~trigger_pipe_source()=default
DTOR.
Interface definition for a container of objects.
Definition: object_list.h:22
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
container type template for a set of object_ptr This template will provide a container for object_ptr...
Definition: object_list.h:216
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Definition: object.h:379
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
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
ucom::ant::object_ptr< IErrorHandling::IErrorHandler > create_error_handler(const char *strErrorSource, const char *strErrorCategory, IErrorHandling::tAction eDefaultAction)
Creates a new error handler.
tResult check_loop_call_in_trigger_pipe(const adtf::streaming::ant::ITriggerPipeSource &pItem)
Checks a loop call in Trigger Pipe can be created with pItem and all registered subitems.
tResult create_trigger_pipe(const char *strNameOfPipe, adtf::ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe, adtf::ucom::ant::object_list< ITriggerPipeItem > lstNextItems)
Creates a Trigger Pipe with given items in lstNextItems.
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.