ADTF
Loading...
Searching...
No Matches
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{
39 A_UTILS_D(cFilterBase)
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
130template <typename DATABINDING_BEHAVIOUR_CLASS>
131inline tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS& oComponent,
132 adtf_util::cStringList lstItems)
133{
135 for (const auto& itElem : lstItems)
136 {
138 if (IS_FAILED(oComponent.FindPin(itElem, pCurrentItem)))
139 {
140 if (IS_FAILED(oComponent.FindRunner(itElem, pCurrentItem)))
141 {
142 RETURN_ERROR(ERR_NOT_FOUND);
143 }
144 }
145 lstListOfItemsForPipe.PushObject(pCurrentItem);
146 }
148 RETURN_IF_FAILED(create_trigger_pipe("generated_pipe", pInnerPipe, lstListOfItemsForPipe));
149 RETURN_IF_FAILED(oComponent.RegisterInnerPipe(pInnerPipe));
150 return pInnerPipe->Open();
151}
152
171template <typename DATABINDING_BEHAVIOUR_CLASS, typename RUN_FUNC>
172tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS& oComponent,
173 const adtf_util::cString& strNameOfRunner,
174 const adtf_util::cString& strSource,
175 RUN_FUNC&& oRunFunc)
176{
179 if (IS_FAILED(oComponent.FindPin(strSource, pCurrentItem)))
180 {
181 if (IS_FAILED(oComponent.FindRunner(strSource, pCurrentItem)))
182 {
183 RETURN_ERROR(ERR_NOT_FOUND);
184 }
185 }
186 lstListOfItemsForPipe.PushObject(pCurrentItem);
187 ucom::object_ptr<IRunner> pRunner = ucom::make_object_ptr<cRunner>(strNameOfRunner, std::forward<RUN_FUNC>(oRunFunc));
188 RETURN_IF_FAILED(oComponent.RegisterRunner(pRunner));
189
190 lstListOfItemsForPipe.PushObject(ucom::ucom_object_ptr_cast<ITriggerPipeItem>(pRunner));
191
193 RETURN_IF_FAILED(create_trigger_pipe("generated_pipe", pInnerPipe, lstListOfItemsForPipe));
194 RETURN_IF_FAILED(oComponent.RegisterInnerPipe(pInnerPipe));
195 return pInnerPipe->Open();
196}
197
207template<typename INTERFACE>
209 const char* strServerName,
210 const adtf::ucom::iobject_ptr<INTERFACE>& pServerInterface)
211{
212 using namespace adtf::ucom;
213 object_ptr<IBindingServer> pBindingServer = make_object_ptr<cBindingServer>(strServerName,
215 ucom_object_ptr_cast<IObject>(pServerInterface));
216 RETURN_IF_FAILED(oFilter.RegisterBindingObject(pBindingServer));
218}
219
227template<typename INTERFACE>
228tResult create_client(cFilterBase& oFilter, const char* strClientName)
229{
230 using namespace adtf::ucom;
231 object_ptr<IBindingClient> pBindingClient = make_object_ptr<cBindingClient>(strClientName,
233 RETURN_IF_FAILED(oFilter.RegisterBindingObject(pBindingClient));
235}
236
245 const char* strNameOfRunner,
247{
248 return oFilter.RegisterRunner(strNameOfRunner, oRunnable);
249}
250
251
252} //namespace ant
253
254namespace flash
255{
256
258
269template<typename Interface, typename InterfaceBinding>
270tResult create_server(InterfaceBinding& oInterfaceBinding,
271 const char* strServerName,
272 const adtf::ucom::iobject_ptr<Interface>& pServerInterface)
273{
274 using namespace adtf::ucom;
275 object_ptr<IBindingServer> pBindingServer = make_object_ptr<cBindingServer>(strServerName,
277 ucom_object_ptr_cast<IObject>(pServerInterface));
278 RETURN_IF_FAILED(oInterfaceBinding.RegisterBindingObject(pBindingServer));
280}
281
290template<typename Interface, typename InterfaceBinding>
291tResult create_client(InterfaceBinding& oInterfaceBinding, const char* strClientName)
292{
293 using namespace adtf::ucom;
294 object_ptr<IBindingClient> pBindingClient = make_object_ptr<cBindingClient>(strClientName,
296 RETURN_IF_FAILED(oInterfaceBinding.RegisterBindingObject(pBindingClient));
298}
299
300}
301
303using ant::cFilterBase;
308
309} //namespace streaming
310} //namespace adtf
#define IS_FAILED(s)
Check if result is failed.
Definition result.h:20
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
Definition result.h:42
Definition runnable_intf.h:27
tFilterState
Definition filter_intf.h:44
Definition interface_binding_type.h:96
virtual tResult RegisterPin(const ucom::ant::iobject_ptr< IPin > &pIPin)
The cFilterBase class implements a basic filter that supports the ant::IFilter interfaces.
Definition filterbase.h:37
tResult Shutdown(tInitStage eStage) override
tResult Init(tInitStage eStage) override
tResult SetState(IFilter::tFilterState eState) override
ucom::object_ptr< services::ant::IReferenceClock > _clock
Definition filterbase.h:55
cFilterLevelmachine::tInitStage tInitStage
private d-pointer
Definition filterbase.h:46
tInitStage
The Filters InitStages will be used for the cFilterLevelmachine::Init and cFilterLevelmachine::Shutdo...
Definition filter_levelmachine.h:45
virtual tResult RegisterBindingObject(const ucom::ant::iobject_ptr< IBindingObject > &pBindingObject)
virtual tResult RegisterRunner(const ucom::ant::iobject_ptr< IRunner > &pRunner)
virtual tResult RegisterInnerPipe(const ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe)
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition object_ptr.h:384
Definition object.h:397
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
Definition bindingproxyoutport.h:16
tResult create_server(cFilterBase &oFilter, const char *strServerName, const adtf::ucom::iobject_ptr< INTERFACE > &pServerInterface)
Definition filterbase.h:208
tResult create_runner(cFilterBase &oFilter, const char *strNameOfRunner, adtf::base::ant::IRunnable &oRunnable)
Definition filterbase.h:244
tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS &oComponent, adtf_util::cStringList lstItems)
Definition filterbase.h:131
tResult create_client(cFilterBase &oFilter, const char *strClientName)
Definition filterbase.h:228
Namespace for all functionality of the ADTF Streaming SDK provided since v3.5.
Definition filterbase.h:255
tResult create_client(InterfaceBinding &oInterfaceBinding, const char *strClientName)
Definition filterbase.h:291
tResult create_inner_pipe(DATABINDING_BEHAVIOUR_CLASS &oComponent, adtf_util::cStringList lstItems)
Definition filterbase.h:131
tResult create_server(InterfaceBinding &oInterfaceBinding, const char *strServerName, const adtf::ucom::iobject_ptr< Interface > &pServerInterface)
Definition filterbase.h:270
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
tResult create_trigger_pipe(const char *strNameOfPipe, adtf::ucom::ant::iobject_ptr< ITriggerPipe > &pTriggerPipe, adtf::ucom::ant::object_list< ITriggerPipeItem > lstNextItems)
object_enum< T, INTERFACE_TYPE, std::list > object_list
Definition object_list.h:402
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
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.
Definition object_ptr_utilities.h:104
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:437
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
Definition object_ptr_utilities.h:129
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14