CPN
Computational Process Networks
QueueReader.cc
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
24 #include "common_priv.h"
25 #include <cpn/bits/QueueReader.h>
26 #include <cpn/bits/QueueReleaser.h>
27 #include "QueueBase.h"
28 
29 namespace CPN {
30 
31  QueueReader::QueueReader(QueueReleaser *qr, shared_ptr<QueueBase> q)
32  : releaser(qr), queue(q)
33  {
34  }
35 
37  queue->ShutdownReader();
38  }
39 
40  const void* QueueReader::GetRawDequeuePtr(unsigned thresh, unsigned chan) {
41  return queue->GetRawDequeuePtr(thresh, chan);
42  }
43 
44  void QueueReader::Dequeue(unsigned count) { queue->Dequeue(count); }
45 
46  bool QueueReader::RawDequeue(void *data, unsigned count,
47  unsigned numChans, unsigned chanStride) {
48  return queue->RawDequeue(data, count, numChans, chanStride);
49  }
50 
51  bool QueueReader::RawDequeue(void *data, unsigned count) {
52  return queue->RawDequeue(data, count);
53  }
54 
55  void QueueReader::Reset() { queue->Reset(); }
56 
57  bool QueueReader::Flushed() const { return queue->Flushed(); }
58 
59  unsigned QueueReader::NumChannels() const { return queue->NumChannels(); }
60 
61  unsigned QueueReader::MaxThreshold() const { return queue->MaxThreshold(); }
62 
63  unsigned QueueReader::QueueLength() const { return queue->QueueLength(); }
64 
65  unsigned QueueReader::Count() const { return queue->Count(); }
66 
67  bool QueueReader::Empty() const { return queue->Empty(); }
68 
69  const std::string &QueueReader::GetDatatype() const {
70  return queue->GetDatatype();
71  }
72 
73  unsigned QueueReader::ChannelStride() const { return queue->DequeueChannelStride(); }
74 
75  Key_t QueueReader::GetKey() const { return queue->GetReaderKey(); }
76 
77  void QueueReader::NotifyTerminate() { queue->NotifyTerminate(); }
78 
80  queue->ShutdownReader();
82  }
83 }
84 
Top Representations of generic queues for the CPN library.
const std::string & GetDatatype() const
Definition: QueueReader.cc:69
const void * GetRawDequeuePtr(unsigned thresh, unsigned chan=0)
Definition: QueueReader.cc:40
bool Empty() const
Definition: QueueReader.cc:67
uint64_t Key_t
Definition: common.h:79
unsigned MaxThreshold() const
Definition: QueueReader.cc:61
unsigned ChannelStride() const
Definition: QueueReader.cc:73
void Dequeue(unsigned count)
Definition: QueueReader.cc:44
unsigned Count() const
Definition: QueueReader.cc:65
QueueReleaser * releaser
Definition: QueueReader.h:152
unsigned QueueLength() const
Definition: QueueReader.cc:63
unsigned NumChannels() const
Definition: QueueReader.cc:59
void NotifyTerminate()
Called by the node.
Definition: QueueReader.cc:77
The definition of reader end of the queue.
QueueReader(QueueReleaser *n, shared_ptr< QueueBase > q)
Definition: QueueReader.cc:31
virtual void ReleaseReader(Key_t rkey)=0
Key_t GetKey() const
Definition: QueueReader.cc:75
shared_ptr< QueueBase > queue
Definition: QueueReader.h:153
bool RawDequeue(void *data, unsigned count, unsigned numChans, unsigned chanStride)
Definition: QueueReader.cc:46
bool Flushed() const
Definition: QueueReader.cc:57