ADTF  3.18.2
cLastSampleReader

Sample reader which always provides the last successful received sample. More...

Inheritance diagram for cLastSampleReader:
[legend]

Public Member Functions

tResult GetLastSample (ucom::ant::iobject_ptr< const ISample > &pSample)
 Returns the last Sample received. More...
 
void Reset () override
 
 cSampleReader ()
 Default CTOR.
 
 cSampleReader (ISampleStreamAccess::tMode eAccessMode)
 Default CTOR which defines the access method. More...
 
- Public Member Functions inherited from cSampleReader
 cSampleReader ()
 Default CTOR.
 
 cSampleReader (ISampleStreamAccess::tMode eAccessMode)
 Default CTOR which defines the access method. More...
 
virtual tResult AcceptType (const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 Accept or reject a new stream type - see also AcceptType and IsCompatible implementations. More...
 
tResult BeginStreaming (ISampleStream &oSampleStream) override
 BeginStreaming will open the given Sample Stream for Reading while a connection is establishing. More...
 
tResult EndStreaming () override
 Sample Stream disconnected. More...
 
void SetAcceptTypeCallback (const std::function< tResult(const ucom::iobject_ptr< const IStreamType > &pStreamType)> &fnAcceptTypeCallback)
 Sets a callback function which is called while a Stream Type is received - see also AcceptType and IsCompatible implementations. More...
 
void SetStreamErrorCallback (const std::function< tResult(tResult oStreamError)> &fnStreamErrorCallback)
 A callback function to react on stream errors. More...
 
tResult SetStreamError (const tResult &oError)
 Forward an error to the corresponding stream. More...
 
void GetSampleInStream (ucom::ant::iobject_ptr< ISampleInStream > &pSampleInStream)
 Returns the connected ISampleInStream.
 
void GetLastType (ucom::ant::iobject_ptr< const IStreamType > &pType)
 Returns the connected ISampleInStream.
 
virtual tResult GetNextSample (ucom::ant::iobject_ptr< const ISample > &pSample)
 Gets the next Sample within internal queue which not has been read. More...
 
void Reset () override
 
virtual tResult Push (const IStreamItem &oStreamItem, tTimeStamp tmTime)=0
 Push a new value to the internal sample queue. More...
 
virtual void Clear ()=0
 clears the local queue of the reader either only EndStreaming or incoming event ISampleInStream::IQueueItem::RE_Flush
 
virtual tResult Pop (IStreamItem &oStreamItem)=0
 Returns the next sample from the queue. More...
 
- Public Member Functions inherited from sample_streamer< ISampleReader, cInPin >
 sample_streamer ()=default
 CTOR.
 
 sample_streamer (const char *strName, const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 CTOR initializer. More...
 
virtual ~sample_streamer ()
 DTOR.
 
void SetName (const char *strName)
 Sets the name of the streamer. More...
 
void ResetPin (ucom::ant::object_ptr< cInPin > &pPin)
 Resets the pin reference This is only internaly used. More...
 
void ResetPin ()
 Resets the pin reference to nullptr. More...
 
tResult GetName (base::ant::IString &&strName) const
 Gets the name of the streamer. More...
 
tResult SetType (const ucom::ant::iobject_ptr< const IStreamType > &pStreamType)
 Sets the StreamType of the streamer. More...
 
tResult GetType (ucom::ant::iobject_ptr< const IStreamType > &pStreamType) const override
 
tResult EndStreaming () override
 
- Public Member Functions inherited from ISampleReaderQueue
virtual tResult Push (const IStreamItem &oStreamItem, tTimeStamp tmTime)=0
 Push a new value to the internal sample queue. More...
 
virtual tResult Pop (IStreamItem &oStreamItem)=0
 Returns the next sample from the queue. More...
 
- Public Member Functions inherited from runnable< base::ant::IRunnable::RUN_PUSH, ISampleStream::IPushReadEventSink >
 runnable ()
 CTOR.
 
 runnable (IRunnable::tRunFunction fcRunOnceFunc)
 Main CTOR with callable function. More...
 
virtual ~runnable ()=default
 DTOR.
 
tResult Run (tTimeStamp tmTimeofActivation, IRunnable::tActivationType ui32ActivationType, const void *, size_t) override
 IRunnable::Run implementation which will call m_fcRunOnceFunc if ui32ActivationType is TYPE_OF_ACTIVATION. More...
 
virtual IRunnable::tActivationType GetActivationType () const
 Returns the type of activation implemented. More...
 
- Public Member Functions inherited from object< Bases >
tResult GetInterface (const char *i_strIID, void *&o_pInterface) override
 Query interfaces on an object. More...
 
tResult GetInterface (const char *i_strIID, const void *&o_pInterface) const override
 Provides const correct interface querying. More...
 
void Destroy () const override
 Destruct and deallocate instantiations of type IObject. More...
 
- Public Member Functions inherited from IObject
 ADTF_IID (IObject, "object.ant.ucom.adtf.iid")
 Marks the IObject to be castable with the ucom_cast() More...
 

Protected Member Functions

tResult ReadNextSample (ucom::ant::iobject_ptr< const ISample > &pSample) override
 Collect the next sample by overriding the adtf::streaming::ant::cSampleReader::ReadNextSample.
 
- Protected Member Functions inherited from cSampleReader
tResult Push (tTimeStamp tmTimeofActivation)
 internal Push operation to implement pushread mode
 
tResult ProcessStreamItem (const IStreamItem &oStreamItem)
 This will process the stream items. More...
 
tResult HandleStreamError (tResult nError)
 
- Protected Member Functions inherited from sample_streamer< ISampleReader, cInPin >
 sample_streamer (const sample_streamer &)=delete
 deleted copy CTOR
 
 sample_streamer (sample_streamer &&)=delete
 deleted move CTOR
 
sample_streameroperator= (const sample_streamer &)=delete
 deleted copy operator
 
sample_streameroperator= (sample_streamer &&)=delete
 deleted move operator
 
- Protected Member Functions inherited from ISampleReader
 ~ISampleReader ()=default
 not destructable
 
- Protected Member Functions inherited from ISampleStreamer
 ~ISampleStreamer ()=default
 not destructable
 
- Protected Member Functions inherited from IObject
 ~IObject ()=default
 Protected destructor --> Use implemented Destroy() instead of delete!
 

Protected Attributes

ucom::object_ptr< const ISamplem_pLastValidSample
 Last Sample Reference.
 
- Protected Attributes inherited from sample_streamer< ISampleReader, cInPin >
adtf_util::cString m_strName
 name of the streamer (used i.e. to create the pins name)
 
ucom::object_ptr< const IStreamTypem_pStreamType
 stream type of the streamer
 
ucom::object_ptr< cInPinm_poPin
 pin reference reading/writing from
 
- Protected Attributes inherited from runnable< base::ant::IRunnable::RUN_PUSH, ISampleStream::IPushReadEventSink >
IRunnable::tRunFunction m_fcRunOnceFunc
 given function to call on Run
 

Additional Inherited Members

- Public Types inherited from sample_streamer< ISampleReader, cInPin >
typedef cInPin pin_type
 

Detailed Description

Sample reader which always provides the last successful received sample.

Definition at line 550 of file samplereader.h.

Member Function Documentation

◆ cSampleReader()

cSampleReader
inline

Default CTOR which defines the access method.

Parameters
eAccessModethe access method.
Remarks
Only PushRead access methed is implemented at the moment.

Definition at line 220 of file samplereader.h.

◆ GetLastSample()

tResult GetLastSample ( ucom::ant::iobject_ptr< const ISample > &  pSample)
inline

Returns the last Sample received.

It will always return the last sample received if at least one was within queue. If no sample received since last successfully call the last sample will be returned again. param[out] pSample Sample found

Returns
Standard Result Code
Return values
ERR_EMPTYNo Sample found.

Definition at line 568 of file samplereader.h.

References IS_OK, cLastSampleReader::m_pLastValidSample, cLastSampleReader::ReadNextSample(), iobject_ptr_base< T >::Reset(), and RETURN_ERROR.