ADTF
Loading...
Searching...
No Matches
adtf::streaming::cSampleReader Class Reference

The default Sample Reader will read the incomung Stream of a IInPin. This sample reader has no internal queue! Make sure if you use this sample reader with ISampleStreamAccess::PushRead to register a external queue or to override the adtf::streaming::ant::cSampleReader::ReadNextSample and adtf::streaming::ant::cSampleReader::Push methods. More...

#include <samplereader.h>

Inherits adtf::streaming::flash::ISampleReader.

Inherited by adtf::streaming::flash::sample_reader< ant::cDynamicSampleReaderQueue >, adtf::streaming::flash::sample_reader< ant::time_limited_sample_reader_queue< TIME_RANGE >, STORELASTSAMPLE >, adtf::streaming::flash::sample_reader< ant::size_limited_sample_reader_queue< MAX_SIZE >, STORELASTSAMPLE >, adtf::streaming::flash::sample_reader< cExternalQueuesWrapper, false >, and adtf::streaming::flash::sample_reader< INTERNAL_QUEUE, STORE_LAST_SAMPLE, ACCESS_MODE >.

Public Member Functions

 cSampleReader (ant::ISampleReaderQueue &oQueue, ant::ISampleStreamAccess::tMode eAccessMode, bool bStoreLastSample)
 
void SetName (const char *strName) override
 
tResult GetName (base::ant::IString &&strName) override
 
tResult SetType (const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType) override
 
tResult GetType (ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType) const override
 
tResult BeginStreaming (ISampleStream &oSampleStream) override
 
tResult EndStreaming () override
 
tResult SetStreamerPin (const ucom::ant::iobject_ptr< IStreamerPin > &pStreamerPin) override
 
void SetAcceptTypeCallback (const std::function< tResult(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType)> &fnAcceptTypeCallback)
 Sets a callback function which is called while a Stream Type is received.
 
void SetStreamErrorCallback (const std::function< tResult(tResult oStreamError)> &fnStreamErrorCallback)
 A callback function to react on stream errors.
 
tResult SetStreamError (tResult oError) override
 
tResult GetLastType (ucom::ant::iobject_ptr< const ant::IStreamType > &pType) override
 
tResult GetNextSample (ucom::ant::iobject_ptr< const ant::ISample > &pSample) override
 
tResult GetLastSample (ucom::ant::iobject_ptr< const ant::ISample > &pSample) override
 
void Reset ()
 
tResult ReadAllAvailableItems () override
 
tResult RequestSamples (ucom::ant::iobject_ptr< hollow::IStreamingRequest > &pRequest, uint32_t nSubStreamId, const base::ant::IProperties *pRequestProperties=nullptr)
 
void SetSynchronousTypeUpdateCallback (const std::function< tResult(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType)> &fnRequestTypeUpdateCallback)
 
- Public Member Functions inherited from adtf::streaming::flash::ISampleStreamer
virtual tResult SetStreamerPin (const ucom::ant::iobject_ptr< flash::IStreamerPin > &pStreamerPin)=0
 

Protected Attributes

std::unique_ptr< cImplementation > m_pImplementation
 

Detailed Description

The default Sample Reader will read the incomung Stream of a IInPin. This sample reader has no internal queue! Make sure if you use this sample reader with ISampleStreamAccess::PushRead to register a external queue or to override the adtf::streaming::ant::cSampleReader::ReadNextSample and adtf::streaming::ant::cSampleReader::Push methods.

Constructor & Destructor Documentation

◆ cSampleReader()

adtf::streaming::flash::cSampleReader::cSampleReader ( ant::ISampleReaderQueue & oQueue,
ant::ISampleStreamAccess::tMode eAccessMode,
bool bStoreLastSample )

CTOR

Parameters
oQueueThe queue implementation to use for this sample reader. The sample reader will use this queue to store incoming samples.
eAccessModeThe access mode for the sample stream.
bStoreLastSampleDefines if the sample reader should always store the last sample received.

Member Function Documentation

◆ BeginStreaming()

tResult adtf::streaming::flash::cSampleReader::BeginStreaming ( ISampleStream & pStream)
overridevirtual

Begin streaming on the given sample stream.

Parameters
[in]pStreamthe sample stream.
Returns
Standard result.

Implements adtf::streaming::flash::ISampleStreamer.

◆ EndStreaming()

tResult adtf::streaming::flash::cSampleReader::EndStreaming ( )
overridevirtual

End streaming

Returns
Standard result.

Implements adtf::streaming::flash::ISampleStreamer.

◆ GetLastSample()

tResult adtf::streaming::flash::cSampleReader::GetLastSample ( ucom::ant::iobject_ptr< const ant::ISample > & pSample)
overridevirtual

Reads the latest available sample from the associated sample stream.

If more than a single new sample was availablle, all but the last sample will be discarded.

If no new sample was available the last sample previously fetched will be returned again.

Parameters
[out]pSampleThis will refrerence the sample.
Return values
ERR_EMTPYNo sample available

Implements adtf::streaming::flash::ISampleReader.

◆ GetLastType()

tResult adtf::streaming::flash::cSampleReader::GetLastType ( ucom::ant::iobject_ptr< const ant::IStreamType > & pType)
overridevirtual

Returns the last stream type that was read from the sample stream.

Parameters
[out]pTypeThis will reference the last stream type
Returns

Implements adtf::streaming::flash::ISampleReader.

◆ GetName()

tResult adtf::streaming::flash::cSampleReader::GetName ( base::ant::IString && strName)
overridevirtual

Retrieves the name of the streamer

Parameters
[out]strNameThis will be updated with the name.
Returns
Standard result.

Implements adtf::streaming::flash::ISampleStreamer.

◆ GetNextSample()

tResult adtf::streaming::flash::cSampleReader::GetNextSample ( ucom::ant::iobject_ptr< const ant::ISample > & pSample)
overridevirtual

Reads the next available sample from the associated sample stream.

Parameters
[out]pSampleThis will refrerence the sample.
Return values
ERR_EMTPYNo sample available

Implements adtf::streaming::flash::ISampleReader.

◆ GetType()

tResult adtf::streaming::flash::cSampleReader::GetType ( ucom::ant::iobject_ptr< const ant::IStreamType > & pStreamType) const
overridevirtual

Returns the initial stream type of the streamer.

Parameters
[out]pStreamTypeThis will reference the initial stream type.
Returns
Standard result.

Implements adtf::streaming::flash::ISampleStreamer.

◆ ReadAllAvailableItems()

tResult adtf::streaming::flash::cSampleReader::ReadAllAvailableItems ( )
overridevirtual

Reads all available items from the sample stream into internal queues.

Returns
Standard result.

Implements adtf::streaming::flash::ISampleReader.

◆ RequestSamples()

tResult adtf::streaming::flash::cSampleReader::RequestSamples ( ucom::ant::iobject_ptr< hollow::IStreamingRequest > & pRequest,
uint32_t nSubStreamId,
const base::ant::IProperties * pRequestProperties = nullptr )

RequestSamples of the given Substream to be generated and/or transmitted.

Parameters
[out]pRequestKeep this as long as you request samples to be transmitted.
[in]nSubStreamIdThe id of the Substream.
[in]pRequestPropertiesThe request properties. If nullptr, then defaults will be used.
Returns
Standard Result.

◆ SetAcceptTypeCallback()

void adtf::streaming::flash::cSampleReader::SetAcceptTypeCallback ( const std::function< tResult(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType)> & fnAcceptTypeCallback)

Sets a callback function which is called while a Stream Type is received.

Parameters
[in]fnAcceptTypeCallbackThe callback function is called while AcceptType is executed. It must return ERR_NOERROR to accept the type or any error to reject the new type.

◆ SetName()

void adtf::streaming::flash::cSampleReader::SetName ( const char * strName)
overridevirtual

Sets the name of the streamer. This will be used when creating pins.

Parameters
[in]strNameThe name

Implements adtf::streaming::flash::ISampleStreamer.

◆ SetStreamError()

tResult adtf::streaming::flash::cSampleReader::SetStreamError ( tResult oError)
overridevirtual

Sets an error on the associated sample stream.

Parameters
[in]oErrorThe error.
Returns
Standard result.

Implements adtf::streaming::flash::ISampleReader.

◆ SetStreamErrorCallback()

void adtf::streaming::flash::cSampleReader::SetStreamErrorCallback ( const std::function< tResult(tResult oStreamError)> & fnStreamErrorCallback)

A callback function to react on stream errors.

Parameters
[in]fnStreamErrorCallbackThe callback function which will be called on stream errors

◆ SetSynchronousTypeUpdateCallback()

void adtf::streaming::flash::cSampleReader::SetSynchronousTypeUpdateCallback ( const std::function< tResult(const ucom::ant::iobject_ptr< const ant::IStreamType > &pStreamType)> & fnRequestTypeUpdateCallback)

Sets a callback function which is called while a synchronous type update is receive from the stream.

Parameters
fnRequestTypeUpdateCallbackThe callback function is called while a synchronous type update is received from the stream.

◆ SetType()

tResult adtf::streaming::flash::cSampleReader::SetType ( const ucom::ant::iobject_ptr< const ant::IStreamType > & pStreamType)
overridevirtual

Sets the initial stream type of a streamer.

Parameters
[in]pStreamTypeThe stream type
Returns
Standard result.

Implements adtf::streaming::flash::ISampleStreamer.


The documentation for this class was generated from the following file: