ADTF
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
filterbase.h
Go to the documentation of this file.
1
7#pragma once
9#include "runtime_behaviour.h"
10#include "interface_binding.h"
11#include "data_binding.h"
12#include "named_graph_object.h"
14#include "triggerpipe.h"
15#include "runner.h"
17
18namespace adtf
19{
20namespace streaming
21{
22namespace ant
23{
24
25
34 public ucom::catwo::object<cFilterLevelmachine,
35 ucom::ant::cClassInfo,
36 runtime_behaviour<interface_binding<data_binding<named_graph_object<IFilter>>>>>
37{
40
41 public:
47
48 protected:
49
56
57
58 public:
67 virtual ~cFilterBase();
68
69 public: //overwrites cFilterBaseLevelmachine
71 tResult Init(tInitStage eStage) override;
73 tResult Shutdown(tInitStage eStage) override;
75 tResult Start() override;
77 tResult Stop() override;
78
79 public: // implements IFilter
80 IFilter::tFilterState GetState() const override;
81
92
93
94 public: //overwrites cDataBinding
95 tResult RegisterPin(const ucom::ant::iobject_ptr<IPin>& pPin) override;
96
99 tResult UnregisterPin(const ucom::ant::iobject_ptr<IPin>& pPin) override;
100
101 public: //overwrites cInterfaceBinding
103 tResult RegisterBindingObject(const ucom::ant::iobject_ptr<IBindingObject>& pBindingObject) override;
104
105 public: //implements cFilterBase
108 tResult RegisterRunner(const ucom::ant::iobject_ptr<IRunner>& pBindingObject) override;
109};
110
111
112
132template <typename DATABINDING_BEHAVIOUR_CLASS>
133inline tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS& oComponent,
134 adtf_util::cStringList lstItems)
135{
137 for (const auto& itElem : lstItems)
138 {
140 if (IS_FAILED(oComponent.FindPin(itElem, pCurrentItem)))
141 {
142 if (IS_FAILED(oComponent.FindRunner(itElem, pCurrentItem)))
143 {
144 RETURN_ERROR(ERR_NOT_FOUND);
145 }
146 }
147 lstListOfItemsForPipe.PushObject(pCurrentItem);
148 }
150 RETURN_IF_FAILED(create_trigger_pipe("generated_pipe", pInnerPipe, lstListOfItemsForPipe));
151 RETURN_IF_FAILED(oComponent.RegisterInnerPipe(pInnerPipe));
152 return pInnerPipe->Open();
153}
154
175template <typename DATABINDING_BEHAVIOUR_CLASS>
176tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS& oComponent,
177 const adtf_util::cString& strNameOfRunner,
178 const adtf_util::cString& strSource,
180{
183 if (IS_FAILED(oComponent.FindPin(strSource, pCurrentItem)))
184 {
185 if (IS_FAILED(oComponent.FindRunner(strSource, pCurrentItem)))
186 {
187 RETURN_ERROR(ERR_NOT_FOUND);
188 }
189 }
190 lstListOfItemsForPipe.PushObject(pCurrentItem);
191 ucom::object_ptr<IRunner> pRunner = ucom::make_object_ptr<quiet::cRunner>(strNameOfRunner, oRunFunc);
192 RETURN_IF_FAILED(oComponent.RegisterRunner(pRunner));
193
194 lstListOfItemsForPipe.PushObject(ucom::ucom_object_ptr_cast<ITriggerPipeItem>(pRunner));
195
197 RETURN_IF_FAILED(create_trigger_pipe("generated_pipe", pInnerPipe, lstListOfItemsForPipe));
198 RETURN_IF_FAILED(oComponent.RegisterInnerPipe(pInnerPipe));
199 return pInnerPipe->Open();
200}
201
211template<typename INTERFACE>
213 const char* strServerName,
214 const adtf::ucom::iobject_ptr<INTERFACE>& pServerInterface)
215{
216 using namespace adtf::ucom;
217 object_ptr<IBindingServer> pBindingServer = make_object_ptr<cBindingServer>(strServerName,
219 ucom_object_ptr_cast<IObject>(pServerInterface));
220 RETURN_IF_FAILED(oFilter.RegisterBindingObject(pBindingServer));
222}
223
231template<typename INTERFACE>
232tResult create_client(cFilterBase& oFilter, const char* strClientName)
233{
234 using namespace adtf::ucom;
235 object_ptr<IBindingClient> pBindingClient = make_object_ptr<cBindingClient>(strClientName,
237 RETURN_IF_FAILED(oFilter.RegisterBindingObject(pBindingClient));
239}
240
250 const char* strNameOfRunner,
252{
253 return oFilter.RegisterRunner(strNameOfRunner, oRunnable);
254}
255
256
257} //namespace ant
258
259namespace flash
260{
261
263
264template <typename DATABINDING_BEHAVIOUR_CLASS, typename RUN_FUNC>
265tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS& oComponent,
266 const adtf_util::cString& strNameOfRunner,
267 const adtf_util::cString& strSource,
268 RUN_FUNC oRunFunc)
269{
272 if (IS_FAILED(oComponent.FindPin(strSource, pCurrentItem)))
273 {
274 if (IS_FAILED(oComponent.FindRunner(strSource, pCurrentItem)))
275 {
276 RETURN_ERROR(ERR_NOT_FOUND);
277 }
278 }
279 lstListOfItemsForPipe.PushObject(pCurrentItem);
280 ucom::object_ptr<IRunner> pRunner = ucom::make_object_ptr<quiet::cRunner>(strNameOfRunner, oRunFunc);
281 RETURN_IF_FAILED(oComponent.RegisterRunner(pRunner));
282
283 lstListOfItemsForPipe.PushObject(ucom::ucom_object_ptr_cast<ITriggerPipeItem>(pRunner));
284
285 adtf::ucom::ant::object_ptr<ITriggerPipe> pInnerPipe;
286 RETURN_IF_FAILED(create_trigger_pipe("generated_pipe", pInnerPipe, lstListOfItemsForPipe));
287 RETURN_IF_FAILED(oComponent.RegisterInnerPipe(pInnerPipe));
288 return pInnerPipe->Open();
289}
290
301template<typename Interface, typename InterfaceBinding>
302tResult create_server(InterfaceBinding& oInterfaceBinding,
303 const char* strServerName,
304 const adtf::ucom::iobject_ptr<Interface>& pServerInterface)
305{
306 using namespace adtf::ucom;
307 object_ptr<IBindingServer> pBindingServer = make_object_ptr<cBindingServer>(strServerName,
309 ucom_object_ptr_cast<IObject>(pServerInterface));
310 RETURN_IF_FAILED(oInterfaceBinding.RegisterBindingObject(pBindingServer));
312}
313
322template<typename Interface, typename InterfaceBinding>
323tResult create_client(InterfaceBinding& oInterfaceBinding, const char* strClientName)
324{
325 using namespace adtf::ucom;
326 object_ptr<IBindingClient> pBindingClient = make_object_ptr<cBindingClient>(strClientName,
328 RETURN_IF_FAILED(oInterfaceBinding.RegisterBindingObject(pBindingClient));
330}
331
332}
333
335using ant::cFilterBase;
336using flash::create_inner_pipe;
340
341} //namespace streaming
342} //namespace adtf
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.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
The Runnable interface defines common methods for a running component.
Runnable helper implementaton template.
Definition runnable.h:58
tFilterState
specifies the several types of filter states
Definition filter_intf.h:44
Binding type generation template to initialize a BindingType with the information of the INTERFACE ty...
virtual tResult RegisterPin(const ucom::ant::iobject_ptr< IPin > &pIPin)
Registers a Pin in a pin list.
The cFilterBase class implements a basic filter that supports the IFilter interfaces.
Definition filterbase.h:37
ucom::object_ptr< services::ant::IReferenceClock > _clock
A reference to the clock service.
Definition filterbase.h:55
tResult Shutdown(tInitStage eStage) override
Implements the default cFilterLevelmachine state machine call.
cFilterLevelmachine::tInitStage tInitStage
private d-pointer
Definition filterbase.h:46
tResult SetState(IFilter::tFilterState eState) override
Sets the state of the filter.
virtual ~cFilterBase()
Destructor.
tResult Init(tInitStage eStage) override
Implements the default cFilterLevelmachine state machine call.
tResult Stop() override
Implements the default cFilterLevelmachine state machine calls.
tResult Start() override
Implements the default cFilterLevelmachine state machine calls.
tInitStage
The Filters InitStages will be used for the cFilterLevelmachine::Init and cFilterLevelmachine::Shutdo...
virtual tResult RegisterBindingObject(const ucom::ant::iobject_ptr< IBindingObject > &pBindingObject)
RegisterBindingObject will register the given pBindingObject within the internal registry.
virtual tResult RegisterRunner(const ucom::ant::iobject_ptr< IRunner > &pRunner)
Registers and publishes a IRunner object to the IRuntimeBehaviour.
virtual tResult RegisterInnerPipe(const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
Registers and publishes an inner ITriggerPipe object to the IRuntimeBehaviour.
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:397
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition d_ptr.h:270
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
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.
tResult create_server(cFilterBase &oFilter, const char *strServerName, const adtf::ucom::iobject_ptr< INTERFACE > &pServerInterface)
Creates a binding server object for the given INTERFACE type and register it on the cFilterBase insta...
Definition filterbase.h:212
tResult create_runner(cFilterBase &oFilter, const char *strNameOfRunner, adtf::base::ant::IRunnable &oRunnable)
Creates a runner on the given cFilterBase and connect it to the given Runnable You only need to imple...
Definition filterbase.h:249
tResult create_client(cFilterBase &oFilter, const char *strClientName)
Creates a binding client object for the given INTERFACE type and register it on the cFilterBase insta...
Definition filterbase.h:232
tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS &oComponent, adtf_util::cStringList lstItems)
Creates a Trigger Pipe and registers it at the given oFilter instance.
Definition filterbase.h:133
tResult create_client(InterfaceBinding &oInterfaceBinding, const char *strClientName)
Creates a binding client object for the given INTERFACE type and register it on the cFilterBase insta...
Definition filterbase.h:323
tResult create_server(InterfaceBinding &oInterfaceBinding, const char *strServerName, const adtf::ucom::iobject_ptr< Interface > &pServerInterface)
Creates a binding server object for the given INTERFACE type and register it on the cFilterBase insta...
Definition filterbase.h:302
Namespace for the ADTF Streaming SDK.
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.
object_enum< T, INTERFACE_TYPE, std::list > object_list
Implementation of an iobject_list<INTERFACE_TYPE> interface by using a std::list as container type.
Namespace for the ADTF uCOM3 SDK.
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Alias always bringing the latest version of ant::ucom_object_ptr_cast() into scope.
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.