ADTF  3.18.2
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 
17 namespace adtf
18 {
19 namespace streaming
20 {
21 namespace ant
22 {
23 
28 class streaming_level_machine : public adtf::ucom::level_machine < streaming_level_machine,
29  IStreamingService::tStreamingState,
30  IStreamingService::tStreamingState::State_Shutdown >
31 {
32 protected:
33  streaming_level_machine() = default;
36  streaming_level_machine& operator=(const streaming_level_machine&) = delete;
37  streaming_level_machine& operator=(streaming_level_machine&&) = delete;
38 
39 protected:
40  tResult SetLevel(IStreamingService::tStreamingState eStreamingState)
41  {
46 
50  >(eStreamingState)));
51 
53  }
54 
55 protected:
56 
69  virtual tResult Construct()
70  {
72  }
73 
81  virtual tResult Destruct()
82  {
84  }
85 
98  virtual tResult Init()
99  {
101  }
102 
110  virtual tResult Shutdown()
111  {
113  }
114 
125  {
127  }
128 
145  {
147  }
148 };
149 
174  public cRuntimeBehaviour,
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 
185 public:
186  cSampleStreamingSource() = default;
187  cSampleStreamingSource(const char* strName)
188  {
190  }
191  virtual ~cSampleStreamingSource()
192  {
194  }
195 
196 public:
197  tResult SetState(IStreamingSource::tStreamingState eState) override;
198  IStreamingSource::tStreamingState GetState() override;
199 
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 
213  tResult StopStreaming() override;
214 };
215 
216 }
217 namespace 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 
279 using catwo::cSampleStreamingSource;
280 
281 }
282 }
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.
#define RETURN_IF_POINTER_NULL(_ptr)
Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResul...
Interface for a NamedGraphObject which can be added to the FilterGraph.
tStreamingState
States of the Streaming Services.
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.
tResult ReleasePins()
Unregisters all Pins from the pin list.
Default implementation for the IRuntimeBehaviour.
Basic implementation for a Streaming Source.
tResult StopStreaming() override
StopStreaming transission while changing from tStreamingState::State_Streaming to tStreamState::State...
virtual tResult RegisterPin(const ucom::ant::iobject_ptr< IPin > &pIPin)
Registers a Pin in a pin list.
tResult StartStreaming() override
StatrStreaming transission while changing from tStreamState::State_Initialized to tStreamingState::St...
tResult Destruct() override
Destruct transission while changing from tStreamingState::State_Constructed to tStreamState::State_Sh...
tResult SetName(const char *strName) override
Sets the Name of the object.
The Streaming Service Level Machine implementation.
virtual tResult StopStreaming()
StopStreaming transission while changing from tStreamingState::State_Streaming to tStreamState::State...
virtual tResult Construct()
Construct transission while changing from tStreamingState::State_Shutdown to tStreamState::State_Cons...
virtual tResult StartStreaming()
StatrStreaming transission while changing from tStreamState::State_Initialized to tStreamingState::St...
virtual tResult Shutdown()
Shutdown transission while changing from tStreamState::State_Initialized to tStreamingState::State_Co...
virtual tResult Init()
Init transission while changing from tStreamingState::State_Constructed to tStreamState::State_Initia...
virtual tResult Destruct()
Destruct transission while changing from tStreamingState::State_Constructed to tStreamState::State_Sh...
Basic implementation for a Streaming Source.
virtual T * Get() const =0
Get raw pointer to shared object.
Base object pointer to realize binary compatible reference counting in interface methods.
Generator template to create a Basic Level Machine implmentation.
Definition: level_machine.h:26
tResult ChangeLevel(LevelType eLevel)
Change Level raise or decrease the Level level by level and call the given hendler methods.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
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.
tResult create_server(cSampleStreamingSink &oStreamingSink, 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 cSampleStreamingS...
tResult create_client(cSampleStreamingSink &oStreamingSink, const char *strClientName)
Creates a binding client object for the given INTERFACE type and register it on the cSampleStreamingS...
std::enable_if< !std::is_base_of< enable_object_ptr_from_this< typename std::remove_cv< Implementation >::type >, typename std::remove_cv< Implementation >::type >::value, object_ptr< Implementation > >::type make_object_ptr(Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.
Namespace for the ADTF uCOM3 SDK.
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Definition of handler method.
Definition: level_machine.h:56