ADTF
|
A simple Sample Queue that hold Samples in a sorted way by time. More...
Public Member Functions | |
cSampleQueue (tTimeStamp tmTimeRange, size_t szMaxSize, bool bClearOnTimeJumps=false) | |
Constructor. More... | |
virtual | ~cSampleQueue () |
Destructor. | |
tResult | Push (const iobject_ptr< ISample > &pSample) |
tResult | Pop (iobject_ptr< ISample > &pSample) |
tResult | Pop () |
tResult | Top (iobject_ptr< ISample > &pSample) |
size_t | GetSize () |
bool | Empty () |
tResult | Get (iobject_ptr< ISample > &pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT, uint32_t ui32GetMethod=SQG_GetLast) |
tResult | RegisterQueueEventSink (ISampleQueueEventSink *pQueueEventSink) |
tResult | UnregisterQueueEventSink (const ISampleQueueEventSink *pQueueEventSink) |
tResult | GetSettings (tTimeStamp &tmTimeRange, size_t &szSizeRange) const |
tResult | SetSettings (const tTimeStamp tmTimeRange, const size_t szSizeRange) |
void | GetTimes (tTimeStamp &tmFirst, tTimeStamp &tmLast) const |
tResult | Clear () |
Clears the SampleQueue. More... | |
tResult | SetRanges (tTimeStamp tmTimeRange, size_t szMaxSize=0) |
Set The Sample Queue Ranges (sizes). More... | |
tResult | HandleEvent (ucom::IEventSource *pSource, void *pvEventData) |
Public Member Functions inherited from object< ISampleQueue > | |
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 Types | |
typedef std::multimap< adtf::base::tNanoSeconds, adtf::ucom::ant::object_ptr< ISample > > | tSampleQueue |
Sample queue is organized as multi set. | |
Protected Member Functions | |
tResult | ClearEventList () |
Clear all buffered queue events. More... | |
tResult | GetNearest2 (iobject_ptr< ISample > &pSampleOlder, iobject_ptr< ISample > &pSampleNewer, tTimeStamp tmTime) |
Search the two samples which are nearest to a given timestamp. More... | |
tResult | GetNearest (iobject_ptr< ISample > &pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT) |
Get the sample which is nearest to a given timestamp. More... | |
tResult | GetNearestOlder (iobject_ptr< ISample > &pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT) |
Get the sample which is nearest to and older than a given timestamp. More... | |
tResult | GetNearestNewer (iobject_ptr< ISample > &ppSample, tTimeStamp tmTime, tTimeStamp tmDeltaT) |
Get the sample which is nearest to and newer than a given timestamp. More... | |
tResult | FireEvent (uint32_t ui32Event, int nParam1, int nParam2) |
Fires the Event to all registered ISampleQueueEventSink. More... | |
Protected Member Functions inherited from IObject | |
~IObject ()=default | |
Protected destructor --> Use implemented Destroy() instead of delete! | |
Protected Attributes | |
adtf::base::tNanoSeconds | m_tmTimeRange |
Time range of the samples in the queue. | |
size_t | m_szMaxSize |
Maximum size of queue. | |
bool | m_bError |
Error indicator. | |
bool | m_bTimeStampsInitialized |
m_tmFirstTime and m_tmLastTime initialized? | |
adtf::base::tNanoSeconds | m_tmFirstTime |
First timestamp in queue. | |
adtf::base::tNanoSeconds | m_tmLastTime |
Last timestamp in queue. | |
std::recursive_mutex | m_oEventListLocked |
Event list lock - RAII-pattern. | |
std::list< ISampleQueueEventSink * > | m_lstQueueEventReceiver |
Event receivers. | |
bool | m_bFireEvents |
Fire events? | |
int | m_nClearingQueueCount |
Clearing queue count. | |
adtf::ucom::object_ptr< ISample > | m_pLastSample |
Last sample of the queue. | |
std::shared_mutex | m_oQueueReadWriteLock |
Queue lock. | |
tSampleQueue | m_qSamples |
The sample queue. | |
Private Member Functions | |
tResult | InternalPop (iobject_ptr< ISample > &pSample) |
A simple Sample Queue that hold Samples in a sorted way by time.
Please note that these queues do not react on runlevel or filter state changes. So you have to clear them manually in your cFilter::Start or cFilter::Stop methods.
Definition at line 52 of file samplequeue.h.
cSampleQueue | ( | tTimeStamp | tmTimeRange, |
size_t | szMaxSize, | ||
bool | bClearOnTimeJumps = false |
||
) |
Constructor.
When one of the parameter is set to zero, only the non-zero parameter is observed.
[in] | tmTimeRange | The maximum time difference between the first and the last sample in the queue. (in micro seconds) If this is exceeded, the first samples in the queue will be dropped until the length of the queue (timespan) fits in this range again. 0 = no limit. |
[in] | szMaxSize | The maximum size of the queue (number of samples). If this is exceeded, the first samples in the queue will be dropped until the length of the queue is equal to this value. 0 = no limit. |
[in] | bClearOnTimeJumps | Whether or not the queue should listen for time jump events and clear itself when those occur. Note that in most cases it is better to handle these jumps at a higher level (Filter, etc.) to prevent side effects when the time jumps during processing of the queue. |
tResult Clear | ( | ) |
Clears the SampleQueue.
This will clear the SampleQueue and unrefs all inserted Samples.
|
protected |
Clear all buffered queue events.
|
protected |
Fires the Event to all registered ISampleQueueEventSink.
ui32Event | [in] The event identifier (ISampleQueueEventSink::tSampleQueueEvent). |
nParam1 | [in] User parameter 1 |
nParam2 | [in] User parameter 2 |
|
protected |
Get the sample which is nearest to a given timestamp.
For the Sample parameter ppSample it is necessary to use a ucom::ant::iobject_ptr of ISample class.
pSample | [out] The nearest sample |
tmTime | [in] The timestamp |
tmDeltaT | [in] The maximum deviation from tmTime that the sample is allowed to have |
|
protected |
Search the two samples which are nearest to a given timestamp.
For the Sample parameters ppSampleOlder and ppSampleNewer it is necessary to use a ucom::ant::iobject_ptr of ISample class.
pSampleOlder | [out] The nearest sample which is older than tmTime |
pSampleNewer | [out] The nearest sample which is newer than tmTime |
tmTime | [in] The timestamp |
|
protected |
Get the sample which is nearest to and newer than a given timestamp.
For the Sample parameter ppSample it is necessary to use a ucom::ant::iobject_ptr of ISample class.
ppSample | [out] The nearest sample |
tmTime | [in] The timestamp |
tmDeltaT | [in] The maximum deviation from tmTime that the sample is allowed to have |
|
protected |
Get the sample which is nearest to and older than a given timestamp.
pSample | [out] The nearest sample |
tmTime | [in] The timestamp |
tmDeltaT | [in] The maximum deviation from tmTime that the sample is allowed to have |
tResult SetRanges | ( | tTimeStamp | tmTimeRange, |
size_t | szMaxSize = 0 |
||
) |
Set The Sample Queue Ranges (sizes).
Please see the documentation of the constructor.
tmTimeRange | [in] Time range. |
szMaxSize | [in] Maximum size. |