CPN
Computational Process Networks
QueueWriter.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/QueueWriter.h>
26 #include <cpn/bits/QueueReleaser.h>
27 #include "QueueBase.h"
28 
29 namespace CPN {
30 
31  QueueWriter::QueueWriter(QueueReleaser *qr, shared_ptr<QueueBase> q)
32  : releaser(qr), queue(q)
33  {
34  }
35 
37  queue->ShutdownWriter();
38  }
39  void* QueueWriter::GetRawEnqueuePtr(unsigned thresh, unsigned chan) {
40  return queue->GetRawEnqueuePtr(thresh, chan);
41  }
42  void QueueWriter::Enqueue(unsigned count) { queue->Enqueue(count); }
43 
44  void QueueWriter::RawEnqueue(const void *data, unsigned count,
45  unsigned numChans, unsigned chanStride) {
46  queue->RawEnqueue(data, count, numChans, chanStride);
47  }
48 
49  void QueueWriter::RawEnqueue(const void *data, unsigned count) {
50  queue->RawEnqueue(data, count);
51  }
52 
53  void QueueWriter::Flush() { queue->Flush(); }
54 
55  bool QueueWriter::Flushed() const { return queue->Flushed(); }
56 
57  unsigned QueueWriter::NumChannels() const { return queue->NumChannels(); }
58 
59  unsigned QueueWriter::MaxThreshold() const { return queue->MaxThreshold(); }
60 
61  unsigned QueueWriter::QueueLength() const { return queue->QueueLength(); }
62 
63  unsigned QueueWriter::Freespace() const { return queue->Freespace(); }
64 
65  bool QueueWriter::Full() const { return queue->Full(); }
66 
67  unsigned QueueWriter::ChannelStride() const { return queue->EnqueueChannelStride(); }
68 
69  const std::string &QueueWriter::GetDatatype() const { return queue->GetDatatype(); }
70 
71  Key_t QueueWriter::GetKey() const { return queue->GetWriterKey(); }
72 
73  void QueueWriter::NotifyTerminate() { queue->NotifyTerminate(); }
74 
76  queue->ShutdownWriter();
78  }
79 
80 }
81 
virtual void ReleaseWriter(Key_t wkey)=0
void * GetRawEnqueuePtr(unsigned thresh, unsigned chan=0)
Definition: QueueWriter.cc:39
Top Representations of generic queues for the CPN library.
Key_t GetKey() const
Definition: QueueWriter.cc:71
unsigned Freespace() const
Definition: QueueWriter.cc:63
unsigned NumChannels() const
Definition: QueueWriter.cc:57
uint64_t Key_t
Definition: common.h:79
shared_ptr< QueueBase > queue
Definition: QueueWriter.h:159
bool Flushed() const
Definition: QueueWriter.cc:55
void Enqueue(unsigned count)
Definition: QueueWriter.cc:42
unsigned QueueLength() const
Definition: QueueWriter.cc:61
bool Full() const
Definition: QueueWriter.cc:65
void NotifyTerminate()
Called by the node.
Definition: QueueWriter.cc:73
const std::string & GetDatatype() const
Definition: QueueWriter.cc:69
QueueReleaser * releaser
Definition: QueueWriter.h:158
void RawEnqueue(const void *data, unsigned count, unsigned numChans, unsigned chanStride)
Definition: QueueWriter.cc:44
Definition for the Queue writer inteface.
unsigned MaxThreshold() const
Definition: QueueWriter.cc:59
unsigned ChannelStride() const
Definition: QueueWriter.cc:67
QueueWriter(QueueReleaser *qr, shared_ptr< QueueBase >)
Definition: QueueWriter.cc:31