24 #include "common_priv.h"
38 : readerkey(attr.GetReaderKey()),
39 writerkey(attr.GetWriterKey()),
52 useD4R(kernel->UseD4R()),
54 datatype(attr.GetDatatype())
56 std::ostringstream oss;
104 char *dest = (
char*)data;
105 if (!src) {
return false; }
106 memcpy(dest, src, count);
107 for (
unsigned chan = 1; chan < numChans; ++chan) {
111 memcpy(dest, src, count);
171 const char *src = (
char*)data;
172 memcpy(dest, src, count);
173 for (
unsigned chan = 1; chan < numChans; ++chan) {
176 memcpy(dest, src, count);
273 for (
unsigned chan = 0; chan < num_chans; ++chan) {
274 memset((
char*)ptr + chanstride*chan, 0,
postpad);
303 for (
unsigned chan = 0; chan < num_chans; ++chan) {
304 memset((
char*)ptr + chanstride*chan, 0,
prepad);
402 logger.
Error(
"size: %u, maxthresh: %u count: %u free: %u, flushed: %d",
405 logger.
Error(
"readrequest: %u, writerequest: %u numenqueued: %u, numdequeued: %u",
Logger object that is used for forwarding log messages.
PthreadCondition & Wait(PthreadMutex &mutex)
virtual bool ReadBlocked()
unsigned QueueLength() const
virtual void UnlockedShutdownWriter()
Top Representations of generic queues for the CPN library.
void Grow(unsigned queueLen, unsigned maxThresh)
virtual unsigned UnlockedMaxThreshold() const =0
void * GetRawEnqueuePtr(unsigned thresh, unsigned chan)
PthreadCondition & Broadcast(void)
unsigned EnqueueChannelStride() const
virtual unsigned UnlockedNumEnqueued() const =0
virtual void InternalFlush()
virtual void WaitForFreespace()
unsigned NumChannels() const
unsigned NumEnqueued() const
Definition of the queue attributes.
virtual void WaitForData()
virtual unsigned UnlockedCount() const =0
The Context abstract data type.
void ShutdownReader()
Called by the QueueReader when no more data will be read.
bool RawDequeue(void *data, unsigned count, unsigned numChans, unsigned chanStride)
void Error(const char *fmt,...)
void Dequeue(unsigned count)
virtual unsigned UnlockedDequeueChannelStride() const =0
An exception indicating that the node tried to write to a shutdown queue.
virtual bool WriteBlocked()
virtual bool GrowQueueMaxThreshold()=0
virtual void InternalEnqueue(unsigned count)=0
virtual void UnlockedShutdownReader()
The exceptions specified for the CPN network.
virtual void InternalDequeue(unsigned count)=0
unsigned MaxThreshold() const
virtual void InternalReset()
virtual unsigned UnlockedFreespace() const =0
unsigned WriteRequest()
For unit tests.
void WriteBlock(unsigned qsize)
unsigned ReadRequest()
For unit tests.
virtual unsigned UnlockedNumChannels() const =0
const std::string & Name() const
void Enqueue(unsigned count)
virtual void CheckTerminated()=0
const void * GetRawDequeuePtr(unsigned thresh, unsigned chan)
void NotifyTerminate()
Used to tell any waiting threads that the network is terminating.
virtual unsigned UnlockedEnqueueChannelStride() const =0
void RawEnqueue(const void *data, unsigned count, unsigned numChans, unsigned chanStride)
virtual void * InternalGetRawEnqueuePtr(unsigned thresh, unsigned chan)=0
virtual const void * InternalGetRawDequeuePtr(unsigned thresh, unsigned chan)=0
unsigned DequeueChannelStride() const
unsigned NumDequeued() const
virtual bool UnlockedEmpty() const =0
unsigned Freespace() const
virtual unsigned CalculateGrowSize(unsigned currentsize, unsigned request)=0
virtual void LogState()
For debugging ONLY!! Otherwise non deterministic output.
virtual void UnlockedGrow(unsigned queueLen, unsigned maxThresh)=0
This is a simplified internal representation of the queue attributes needed to create a queue...
void ShutdownWriter()
Called by the QueueWriter when no more data will be written.
virtual bool UnlockedFull() const =0
virtual unsigned UnlockedNumDequeued() const =0
virtual unsigned UnlockedQueueLength() const =0
void Debug(const char *fmt,...)