ADTF
Loading...
Searching...
No Matches
samplequeue.h
Go to the documentation of this file.
1
7#pragma once
8#include "sample_intf.h"
9#include "samplequeue_intf.h"
10#include "sample.h"
11
12#include <shared_mutex>
13
14namespace adtf
15{
16namespace streaming
17{
18namespace ant
19{
20
25{
33 {
34 if (pSample.Get() != nullptr && pSampleAdd.Get() != nullptr)
35 {
37 }
38 return true;
39 }
40};
41
45#define ADTF_SAMPLEQUEUE_CLASS_VERSION_01 0x01
46
54 public ucom::catwo::object<ISampleQueue>
55{
56 A_UTILS_D(cSampleQueue)
57
58 public:
74 cSampleQueue(tTimeStamp tmTimeRange, size_t szMaxSize, bool bClearOnTimeJumps = false);
75
79 virtual ~cSampleQueue();
80
81 protected:
83 size_t m_szMaxSize;
84 bool m_bError;
85
89
90 std::recursive_mutex m_oEventListLocked;
91 std::list<ISampleQueueEventSink*> m_lstQueueEventReceiver;
94
96 std::shared_mutex m_oQueueReadWriteLock;
97
98 typedef std::multimap<adtf::base::tNanoSeconds, adtf::ucom::ant::object_ptr<ISample>> tSampleQueue;
100
101 public: //implements ISampleQueue
102 tResult Push(const iobject_ptr<ISample>& pSample);
103 tResult Pop(iobject_ptr<ISample>& pSample);
104 tResult Pop();
105 tResult Top(iobject_ptr<ISample>& pSample);
106
107 size_t GetSize();
108 bool Empty();
109
110 tResult Get(iobject_ptr<ISample>& pSample,
111 tTimeStamp tmTime,
112 tTimeStamp tmDeltaT,
113 uint32_t ui32GetMethod=SQG_GetLast);
114
115 tResult RegisterQueueEventSink(ISampleQueueEventSink* pQueueEventSink);
116 tResult UnregisterQueueEventSink(const ISampleQueueEventSink* pQueueEventSink);
117
118 tResult GetSettings(tTimeStamp& tmTimeRange, size_t& szSizeRange) const;
119 tResult SetSettings(const tTimeStamp tmTimeRange, const size_t szSizeRange);
120 void GetTimes(tTimeStamp& tmFirst, tTimeStamp& tmLast) const;
121
122 public:
129
139 tResult SetRanges(tTimeStamp tmTimeRange, size_t szMaxSize=0);
140
141 protected:
158 tResult GetNearest2(iobject_ptr<ISample>& pSampleOlder, iobject_ptr<ISample>& pSampleNewer, tTimeStamp tmTime);
170 tResult GetNearest(iobject_ptr<ISample>& pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT);
180 tResult GetNearestOlder(iobject_ptr<ISample>& pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT);
192 tResult GetNearestNewer(iobject_ptr<ISample>& ppSample, tTimeStamp tmTime, tTimeStamp tmDeltaT);
193
203 tResult FireEvent(uint32_t ui32Event,
204 int nParam1,
205 int nParam2);
206
207 public:
208 //not implemented
209 tResult HandleEvent(ucom::IEventSource* pSource, void* pvEventData);
210 private:
211 tResult InternalPop(iobject_ptr<ISample>& pSample);
212};
213
214} //namesapce ant
215} //namespac streaming
216} // namespace adtf
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
Definition samplequeue_intf.h:25
bool m_bTimeStampsInitialized
m_tmFirstTime and m_tmLastTime initialized?
Definition samplequeue.h:86
std::multimap< adtf::base::tNanoSeconds, adtf::ucom::ant::object_ptr< ISample > > tSampleQueue
Sample queue is organized as multi set.
Definition samplequeue.h:98
size_t m_szMaxSize
Maximum size of queue.
Definition samplequeue.h:83
tSampleQueue m_qSamples
The sample queue.
Definition samplequeue.h:99
bool m_bError
Error indicator.
Definition samplequeue.h:84
adtf::base::tNanoSeconds m_tmLastTime
Last timestamp in queue.
Definition samplequeue.h:88
int m_nClearingQueueCount
Clearing queue count.
Definition samplequeue.h:93
std::recursive_mutex m_oEventListLocked
Event list lock - RAII-pattern.
Definition samplequeue.h:90
adtf::ucom::object_ptr< ISample > m_pLastSample
Last sample of the queue.
Definition samplequeue.h:95
tResult FireEvent(uint32_t ui32Event, int nParam1, int nParam2)
bool m_bFireEvents
Fire events?
Definition samplequeue.h:92
tResult SetRanges(tTimeStamp tmTimeRange, size_t szMaxSize=0)
std::list< ISampleQueueEventSink * > m_lstQueueEventReceiver
Event receivers.
Definition samplequeue.h:91
tResult GetNearestNewer(iobject_ptr< ISample > &ppSample, tTimeStamp tmTime, tTimeStamp tmDeltaT)
adtf::base::tNanoSeconds m_tmFirstTime
First timestamp in queue.
Definition samplequeue.h:87
adtf::base::tNanoSeconds m_tmTimeRange
Time range of the samples in the queue.
Definition samplequeue.h:82
cSampleQueue(tTimeStamp tmTimeRange, size_t szMaxSize, bool bClearOnTimeJumps=false)
tResult GetNearestOlder(iobject_ptr< ISample > &pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT)
std::shared_mutex m_oQueueReadWriteLock
Queue lock.
Definition samplequeue.h:96
tResult GetNearest(iobject_ptr< ISample > &pSample, tTimeStamp tmTime, tTimeStamp tmDeltaT)
tResult GetNearest2(iobject_ptr< ISample > &pSampleOlder, iobject_ptr< ISample > &pSampleNewer, tTimeStamp tmTime)
Definition event_source_intf.h:72
virtual T * Get() const =0
Get raw pointer to shared object.
Definition object_ptr.h:384
Definition object.h:397
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
Definition bindingproxyoutport.h:16
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
base::flash::tNanoSeconds get_sample_time(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:437
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
A timestamp with nanosecond precision.
Definition chrono.h:23
bool operator()(const adtf::ucom::iobject_ptr< ISample > &pSampleAdd, const adtf::ucom::iobject_ptr< ISample > &pSample) const
Definition samplequeue.h:32