ADTF  3.18.2
cSampleSetCollector

A class that collects the sample sets from multiple sample readers. More...

Classes

struct  tQueue
 

Public Types

typedef std::function< tResult(cExternalQueueSampleReader &, const adtf::ucom::iobject_ptr< const IStreamType > &pStreamType)> tStreamTypeChangeCallback
 

Public Member Functions

 cSampleSetCollector (tStreamTypeChangeCallback pTypeChangeCallback)
 Constructor with type change callback. More...
 
 cSampleSetCollector (const cSampleSetCollector &)=delete
 
 cSampleSetCollector (cSampleSetCollector &&)=default
 
cSampleSetCollectoroperator= (const cSampleSetCollector &)=delete
 
cSampleSetCollectoroperator= (cSampleSetCollector &&)=default
 
tResult CollectFrom (cExternalQueueSampleReader &oSampleReader)
 Adds a sample reader to the list of sample readers that data is read from. More...
 
void ClearQueues ()
 Clear all internal queues for all connected sample readers.
 
template<typename ... T>
tResult GetNextSampleSet (T &...samples)
 Get the next sample set from all sample readers at least one reader must have new data based on timestamp only the next changed sample (based on timestamp) is updated in sample set. More...
 

Private Member Functions

tResult RetrieveSamples ()
 
template<typename ... T>
tResult GetSamples (adtf::ucom::iobject_ptr< const ISample > &pSample, T &... samples)
 
tResult GetSamples ()
 

Private Attributes

tStreamTypeChangeCallback m_pTypeChangeCallback
 
std::vector< tQueuem_oQueues
 

Detailed Description

A class that collects the sample sets from multiple sample readers.

Usage:

It returns a set of samples for each sample that has arrived. This set contains the new sample and the last ones from the other streams/readers.

(for more detail see sample_reader)

Definition at line 122 of file sample_collectors.h.

Constructor & Destructor Documentation

◆ cSampleSetCollector()

cSampleSetCollector ( tStreamTypeChangeCallback  pTypeChangeCallback)

Constructor with type change callback.

Parameters
[in]pTypeChangeCallbacka callback that is called when ever the stream type of a reader changes.

Member Function Documentation

◆ CollectFrom()

tResult CollectFrom ( cExternalQueueSampleReader oSampleReader)

Adds a sample reader to the list of sample readers that data is read from.

Parameters
[in]oSampleReaderThe sample reader to read data from.
Return values
ERR_NOERRORStream type is valid

◆ GetNextSampleSet()

tResult GetNextSampleSet ( T &...  samples)
inline

Get the next sample set from all sample readers at least one reader must have new data based on timestamp only the next changed sample (based on timestamp) is updated in sample set.

Parameters
[in]samplestemplate interator
Return values
ERR_NOERRORdata is valid
RETURN_IF_FAILED(ERR_INVALID_ARG) more sample were requested than readers registered (to many parameters)
RETURN_ERROR(ERR_EMPTY)no data available

Definition at line 179 of file sample_collectors.h.

References RETURN_ERROR, and RETURN_IF_FAILED.