ADTF
Loading...
Searching...
No Matches
streaming_source.h
Go to the documentation of this file.
1
7#pragma once
8
10#include "runtime_behaviour.h"
11#include "data_binding.h"
12#include "named_graph_object.h"
13#include "interface_binding.h"
16
17namespace adtf
18{
19namespace streaming
20{
21namespace ant
22{
23
28class streaming_level_machine : public adtf::ucom::level_machine < streaming_level_machine,
29 IStreamingService::tStreamingState,
30 IStreamingService::tStreamingState::State_Shutdown >
31{
32protected:
33 streaming_level_machine() = default;
34 streaming_level_machine(const streaming_level_machine&) = delete;
35 streaming_level_machine(streaming_level_machine&&) = delete;
36 streaming_level_machine& operator=(const streaming_level_machine&) = delete;
37 streaming_level_machine& operator=(streaming_level_machine&&) = delete;
38
39protected:
40 tResult SetLevel(IStreamingService::tStreamingState eStreamingState)
41 {
42 RETURN_IF_FAILED((ChangeLevel<
46
50 >(eStreamingState)));
51
53 }
54
55protected:
56
70 {
72 }
73
81 virtual tResult Destruct()
82 {
84 }
85
98 virtual tResult Init()
99 {
101 }
102
111 {
113 }
114
125 {
127 }
128
145 {
147 }
148};
149
173class cSampleStreamingSource:
174 public cRuntimeBehaviour,
175 public streaming_level_machine,
176 public ucom::catwo::object<ucom::ant::cClassInfo,
177 base::ant::configuration<>,
178 IDynamicDataBinding,
179 IStreamingService,
180 IStreamingSource,
181 data_binding<named_graph_object<ISampleStreamingSource>>>
182{
183
184
185public:
186 cSampleStreamingSource() = default;
187 cSampleStreamingSource(const char* strName)
188 {
190 }
191 virtual ~cSampleStreamingSource()
192 {
194 }
195
196public:
197 tResult SetState(IStreamingSource::tStreamingState eState) override;
198 IStreamingSource::tStreamingState GetState() override;
199
201 tResult RegisterPin(const ucom::ant::iobject_ptr<IPin>& pPin);
202
203 tResult RequestPin(const char* strName,
205 adtf::ucom::ant::iobject_ptr<IInPin>& pInPin) override;
206 tResult RequestPin(const char* strName,
208 adtf::ucom::ant::iobject_ptr<IOutPin>& pOutPin) override;
209
210 tResult Destruct() override;
211
214};
215
216}
217namespace catwo
218{
223 public ucom::catwo::object<ant::cSampleStreamingSource, interface_binding<>>
224 {
225 public:
226 using cInterfaceBinding::RegisterBindingObject;
227 tResult RegisterBindingObject(const ucom::ant::iobject_ptr<IBindingObject>& pBindingObject) override
228 {
229 RETURN_IF_POINTER_NULL(pBindingObject.Get());
230
231 pBindingObject.Get()->SetParent(static_cast<INamedGraphObject*>(this));
232
233 return cInterfaceBinding::RegisterBindingObject(pBindingObject);
234 }
235
236 };
237
247 template<typename INTERFACE>
249 const char* strServerName,
250 const adtf::ucom::iobject_ptr<INTERFACE>& pServerInterface)
251 {
252 using namespace adtf::ucom;
253 object_ptr<IBindingServer> pBindingServer = make_object_ptr<cBindingServer>(strServerName,
255 ucom_object_ptr_cast<IObject>(pServerInterface));
256 RETURN_IF_FAILED(oStreamingSource.RegisterBindingObject(pBindingServer));
258 }
259
267 template<typename INTERFACE>
268 tResult create_client(cSampleStreamingSource& oStreamingSource, const char* strClientName)
269 {
270 using namespace adtf::ucom;
271 object_ptr<IBindingClient> pBindingClient = make_object_ptr<cBindingClient>(strClientName,
273 RETURN_IF_FAILED(oStreamingSource.RegisterBindingObject(pBindingClient));
275 }
276
277}
278
279using catwo::cSampleStreamingSource;
280
281}
282}
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_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
Definition result.h:49
Definition named_graph_object_intf.h:25
tStreamingState
Definition streaming_source_intf.h:36
Definition interface_binding_type.h:96
virtual tResult RegisterPin(const ucom::ant::iobject_ptr< IPin > &pIPin)
tResult SetName(const char *strName) override
Definition named_graph_object.h:64
virtual tResult Construct()
Definition streaming_source.h:69
virtual tResult Init()
Definition streaming_source.h:98
virtual tResult Destruct()
Definition streaming_source.h:81
virtual tResult StopStreaming()
Definition streaming_source.h:144
virtual tResult StartStreaming()
Definition streaming_source.h:124
virtual tResult Shutdown()
Definition streaming_source.h:110
Definition streaming_source.h:224
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition level_machine.h:26
tResult ChangeLevel(LevelType eLevel)
Definition level_machine.h:121
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
Namespace for all functionality of the ADTF Streaming SDK provided since v3.2.
Definition bindingproxyinport.h:16
tResult create_server(cSampleStreamingSink &oStreamingSink, const char *strServerName, const adtf::ucom::iobject_ptr< INTERFACE > &pServerInterface)
Definition streaming_sink.h:128
tResult create_client(cSampleStreamingSink &oStreamingSink, const char *strClientName)
Definition streaming_sink.h:148
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
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
Definition level_machine.h:56