ADTF  3.14.3
samplestream.h
Go to the documentation of this file.
1 
7 #pragma once
8 #include "samplestream_intf.h"
9 #include "sampleinstream_intf.h"
10 #include "sampleoutstream_intf.h"
11 #include "streamtype.h"
13 #include "triggerpipe_intf.h"
14 #include "triggerpipe.h"
15 #include "streamingrequests_intf.h"
16 
17 #include <adtfbase/adtf_base.h>
18 #include <adtfucom3/adtf_ucom3.h>
19 
20 #include <memory>
21 
22 namespace adtf
23 {
24 namespace streaming
25 {
26 namespace ant
27 {
28 namespace detail
29 {
37  class cSampleStreamBase: public adtf::base::ant::runnable<adtf::base::ant::IRunnable::RUN_TRIGGER>
38  {
41 
42 
43  protected:
52 
53  public:
57  virtual ~cSampleStreamBase() = default;
58 
63  tResult GetStreamError();
64 
65  public:
68  tResult Open(const char* strName,
70  const adtf::ucom::ant::iobject_ptr<const IStreamType>& pInitialAcceptedStreamType,
71  ISampleStream::IPushReadEventSink*& pPushEventSink,
73  size_t szQueueSize,
74  adtf::ucom::ant::IObject* pParent);
93  tResult Open(const char* strName,
96  size_t szQueueSize,
97  adtf::ucom::ant::IObject* pParent);
98 
101 
108  tTimeStamp GetTime() const;
110  tResult SetStreamError(const tResult& oError);
115 
121  tResult SetFullName(const char* strName);
122 
126  tResult RunTrigger(tTimeStamp tmActivationTime);
127 
134 
139  void SetSubStreamFilter(const char* strSubStream);
140 
144  uint64_t GetItemCount();
145  };
146 }
147 
152  template <typename INTERFACE = ISampleStream>
153  class sample_stream: public ucom::catwo::object<detail::cSampleStreamBase, ISampleStream, named_graph_object<trigger_pipe_item<INTERFACE>>>
154  {
156 
157  protected:
158  sample_stream(sample_stream&&) = delete;
159  sample_stream(const sample_stream&) = delete;
160  sample_stream& operator=(sample_stream&&) = delete;
161  sample_stream& operator=(const sample_stream&) = delete;
162 
163  public:
164  sample_stream()
165  {
166  base_type::SetRunnable(*static_cast<detail::cSampleStreamBase*>(this));
167  }
168  sample_stream(const char* strName) : sample_stream()
169  {
170  SetName(strName);
171  }
172  ~sample_stream() = default;
173 
174  tResult SetName(const char* strName) override
175  {
178  }
179 
180  tResult SetParent(const ucom::ant::IObject* oParentObject) override
181  {
182  RETURN_IF_FAILED(base_type::SetParent(oParentObject));
184  }
185 
186  tResult Open(const char* strName,
188  const adtf::ucom::ant::iobject_ptr<const IStreamType>& pInitialAcceptedStreamType,
189  ISampleStream::IPushReadEventSink*& pPushEventSink,
191  size_t szQueueSize) override
192  {
193  return detail::cSampleStreamBase::Open(strName,
194  pInStream,
195  pInitialAcceptedStreamType,
196  pPushEventSink,
197  ui32Mode,
198  szQueueSize,
199  adtf::ucom::ant::ucom_cast<adtf::ucom::ant::IObject*>(this));
200  }
201 
202  tResult Open(const char* strName,
205  size_t szQueueSize) override
206  {
207  return detail::cSampleStreamBase::Open(strName,
208  pOutStream,
209  ui32Mode,
210  szQueueSize,
211  adtf::ucom::ant::ucom_cast<adtf::ucom::ant::IObject*>(this));
212  }
213 
214  tResult GetType(adtf::ucom::ant::iobject_ptr<const IStreamType>& pStreamType) const override
215  {
216  return detail::cSampleStreamBase::GetType(pStreamType);
217  }
218 
223  tTimeStamp GetTime() const override
224  {
226  }
228  tResult SetStreamError(const tResult& oError) override
229  {
231  }
233  tResult AttachRouting(const adtf::ucom::ant::iobject_ptr<ISampleStream>& pSampleStreamTo) override
234  {
235  return detail::cSampleStreamBase::AttachRouting(pSampleStreamTo);
236  }
238  tResult DetachRouting(const adtf::ucom::ant::iobject_ptr<ISampleStream>& pSampleStreamTo) override
239  {
240  return detail::cSampleStreamBase::DetachRouting(pSampleStreamTo);
241  }
242  };
243 
251  public sample_stream<ISampleStream>
252  {
255 
256  public:
258  ADTF_CLASS_ID_NAME(cSampleStream, "default_sample_stream.streaming.adtf.cid", "Sample Stream");
259 
260  public:
262  template<typename T>
264 
265  protected:
267  cSampleStream(const cSampleStream&) = delete;
274 
275  public:
277  cSampleStream() = default;
279  cSampleStream(const char* strName)
280  {
281  sample_stream::SetName(strName);
282  }
284  virtual ~cSampleStream() = default;
285 
286  };
287 
288 
289 } //namespace ant
290 
291 namespace flash
292 {
293 
294 class cSampleStream: public ucom::catwo::object<base::ant::IRunnable,
295  ant::ITriggerPipeSource,
296  ant::ITriggerPipeItem,
297  ant::INamedGraphObject,
298  ant::ISampleStream,
299  hollow::IInternalBindingProxy,
300  base::flash::IRunnable>
301 {
302  public:
303  ADTF_CLASS_ID_NAME(cSampleStream, "default_sample_stream.streaming.adtf.cid", "Sample Stream");
304 
305  public:
306  cSampleStream();
307  cSampleStream(const char* strName);
308 
309  public:
310  tResult GetStreamError();
311  tResult GetType(ucom::ant::iobject_ptr<const ant::IStreamType>& pStreamType) const override;
312  tTimeStamp GetTime() const override;
313  tResult SetStreamError(const tResult& oError) override;
314  tResult AttachRouting(const ucom::ant::iobject_ptr<ant::ISampleStream>& pSampleStreamTo) override;
315  tResult DetachRouting(const ucom::ant::iobject_ptr<ant::ISampleStream>& pSampleStreamTo) override;
316  tResult Open(const char* strName,
318  const ucom::ant::iobject_ptr<const ant::IStreamType>& pInitialAcceptedStreamType,
321  size_t szQueueSize) override;
322  tResult Open(const char* strName,
325  size_t szQueueSize) override;
326 
327  ADTF_FLASH_TRIGGER_PIPE_ITEM_METHOD_DECLARATIONS
328 
329  tResult GetInternalBindingProxy(ucom::ant::iobject_ptr<ant::IBindingProxy>& pBindingProxy) override;
330  void SetSubStreamFilter(const char* strSubStream);
331  void SetForwardAllTriggers(bool bForwardAll);
332 
333  protected:
334  ~cSampleStream() override;
335 
336  protected:
337  class cImplementation;
338  std::unique_ptr<cImplementation> m_pImplementation;
339 };
340 
341 }
344 
345 using ant::sample_stream;
346 } //namespac streaming
347 } //namespace adtf
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Runnable helper implementaton template.
Definition: runnable.h:58
The Default implementation of the ISampleStream interface.
Definition: samplestream.h:252
A_UTILS_D(cSampleStream)
private d-pointer
cSampleStream(const cSampleStream &)=delete
deleted copy CTOR
cSampleStream & operator=(const cSampleStream &)=delete
deleted copy operator
ADTF_CLASS_ID_NAME(cSampleStream, "default_sample_stream.streaming.adtf.cid", "Sample Stream")
Implements adtf::ucom::IClassInfo.
cSampleStream & operator=(cSampleStream &&)=delete
deleted move operator
cSampleStream(cSampleStream &&)=delete
deleted move CTOR
cSampleStream(const char *strName)
CTOR initializes the name of the stream.
Definition: samplestream.h:279
virtual ~cSampleStream()=default
DTOR.
The implementation of the ISampleStream base implemenation.
Definition: samplestream.h:38
tResult GetType(adtf::ucom::ant::iobject_ptr< const IStreamType > &pStreamType) const
Retrieves the current type of the stream.
tResult RunTrigger(tTimeStamp tmActivationTime)
Internal Run implementation.
tResult AttachRouting(const adtf::ucom::ant::iobject_ptr< ISampleStream > &pSampleStreamTo)
Attaches a SampleStream where to route the Write / Flush and Run calls to.
tResult SetStreamError(const tResult &oError)
Sets and forwards a StreamError to the readers.
void SetSubStreamFilter(const char *strSubStream)
If set, only Stream Types and Samples of the given Substream mwill be forwarded.
tResult Open(const char *strName, adtf::ucom::ant::iobject_ptr< ISampleOutStream > &pOutStream, ISampleStreamAccess::tMode ui32Mode, size_t szQueueSize, adtf::ucom::ant::IObject *pParent)
Opens The SampleStream for writing access.
tTimeStamp GetTime() const
Returns the last flush time and so the current position of the stream.
cSampleStreamBase & operator=(cSampleStreamBase &&)=delete
deleted move operator
tResult Open(const char *strName, adtf::ucom::ant::iobject_ptr< ISampleInStream > &pInStream, const adtf::ucom::ant::iobject_ptr< const IStreamType > &pInitialAcceptedStreamType, ISampleStream::IPushReadEventSink *&pPushEventSink, ISampleStreamAccess::tMode ui32Mode, size_t szQueueSize, adtf::ucom::ant::IObject *pParent)
Opens The SampleStream for reading access.
cSampleStreamBase(const cSampleStreamBase &)=delete
deleted copy CTOR
tResult GetStreamError()
Getter for the last forwarded stream error.
tResult DetachRouting(const adtf::ucom::ant::iobject_ptr< ISampleStream > &pSampleStreamTo)
Detaches a SampleStream where the routing was set by AttachRouting.
tResult GetInternalBindingProxy(ucom::ant::iobject_ptr< ant::IBindingProxy > &pBindingProxy)
Get the internal Binding Proxy.
cSampleStreamBase(cSampleStreamBase &&)=delete
deleted move CTOR
A_UTILS_D(cSampleStreamBase)
private d-pointer
tResult SetFullName(const char *strName)
Set the name which is used for error handling etc.
cSampleStreamBase & operator=(const cSampleStreamBase &)=delete
deleted copy operator
Default convenient implementation for INamedGraphObject.
tResult SetName(const char *strName) override
Sets the Name of the object.
tResult SetParent(const ucom::ant::IObject *poParentObject) override
Sets Parent of the object.
Helper template to implement a ISampleStream or a ISampleStream derived interface.
Definition: samplestream.h:154
tResult AttachRouting(const adtf::ucom::ant::iobject_ptr< ISampleStream > &pSampleStreamTo) override
Attaches a SampleStream where to route the Write / Flush and Run calls to.
Definition: samplestream.h:233
tResult SetStreamError(const tResult &oError) override
Sets and forwards a StreamError to the readers.
Definition: samplestream.h:228
tResult DetachRouting(const adtf::ucom::ant::iobject_ptr< ISampleStream > &pSampleStreamTo) override
Detaches a SampleStream where the routing was set by AttachRouting.
Definition: samplestream.h:238
tTimeStamp GetTime() const override
Returns the last flush time and so the current position of the stream.
Definition: samplestream.h:223
Base class for every interface type within the uCOM.
Definition: object_intf.h:31
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:359
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.
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.
Copyright © Audi Electronics Venture GmbH.
#define RETURN_IF_FAILED(s)
returns if the expression returns a failed tResult or throws an exception.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Thu Jun 9 2022 by doxygen 1.9.1)