24 #ifndef CPN_QUEUEBASE_H
25 #define CPN_QUEUEBASE_H
28 #include "common_priv.h"
55 const void *GetRawDequeuePtr(
unsigned thresh,
unsigned chan);
63 void Dequeue(
unsigned count);
77 bool RawDequeue(
void *data,
unsigned count,
78 unsigned numChans,
unsigned chanStride);
86 bool RawDequeue(
void *data,
unsigned count);
101 void *GetRawEnqueuePtr(
unsigned thresh,
unsigned chan);
114 void Enqueue(
unsigned count);
131 void RawEnqueue(
const void *data,
unsigned count,
132 unsigned numChans,
unsigned chanStride);
139 void RawEnqueue(
const void *data,
unsigned count);
143 bool Flushed()
const;
148 unsigned NumChannels()
const;
153 unsigned Count()
const;
164 unsigned Freespace()
const;
175 unsigned MaxThreshold()
const;
181 unsigned QueueLength()
const;
188 unsigned EnqueueChannelStride()
const;
194 unsigned DequeueChannelStride()
const;
206 void Grow(
unsigned queueLen,
unsigned maxThresh);
215 void ShutdownReader();
217 void ShutdownWriter();
219 void NotifyTerminate();
225 unsigned ReadRequest();
227 unsigned WriteRequest();
228 bool IsReaderShutdown();
229 bool IsWriterShutdown();
232 virtual void LogState();
234 unsigned NumEnqueued()
const;
235 unsigned NumDequeued()
const;
239 virtual void WaitForData();
240 virtual bool ReadBlocked();
242 virtual void WaitForFreespace();
243 virtual bool WriteBlocked();
244 void NotifyFreespace();
247 virtual void Signal() { cond.Broadcast(); }
249 virtual void Detect();
251 virtual const void *InternalGetRawDequeuePtr(
unsigned thresh,
unsigned chan) = 0;
252 virtual void InternalDequeue(
unsigned count) = 0;
253 virtual void *InternalGetRawEnqueuePtr(
unsigned thresh,
unsigned chan) = 0;
254 virtual void InternalEnqueue(
unsigned count) = 0;
256 virtual void InternalFlush();
257 virtual void InternalReset();
258 virtual unsigned UnlockedNumChannels()
const = 0;
259 virtual unsigned UnlockedCount()
const = 0;
260 virtual bool UnlockedEmpty()
const = 0;
261 virtual unsigned UnlockedFreespace()
const = 0;
262 virtual bool UnlockedFull()
const = 0;
263 virtual unsigned UnlockedMaxThreshold()
const = 0;
264 virtual unsigned UnlockedQueueLength()
const = 0;
265 virtual unsigned UnlockedEnqueueChannelStride()
const = 0;
266 virtual unsigned UnlockedDequeueChannelStride()
const = 0;
267 virtual void UnlockedGrow(
unsigned queueLen,
unsigned maxThresh) = 0;
268 virtual void UnlockedShutdownReader();
269 virtual void UnlockedShutdownWriter();
270 virtual unsigned UnlockedNumEnqueued()
const = 0;
271 virtual unsigned UnlockedNumDequeued()
const = 0;
Logger object that is used for forwarding log messages.
PthreadMutex & Lock(void)
Key_t GetReaderKey() const
The base class for all queues in the CPN library.
const std::string & GetDatatype() const
PthreadMutex & Unlock(void)
A very simple logging interface.
Key_t GetWriterKey() const
This is a simplified internal representation of the queue attributes needed to create a queue...