CPN
Computational Process Networks
QueueWriter.h
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 //=============================================================================
25 #ifndef CPN_QUEUEWRITER_H
26 #define CPN_QUEUEWRITER_H
27 #pragma once
28 
29 #include <cpn/common.h>
30 #include <string>
31 
32 namespace CPN {
33 
38  public:
39 
40  QueueWriter(QueueReleaser *qr, shared_ptr<QueueBase>);
41 
42  ~QueueWriter();
43 
59  void* GetRawEnqueuePtr(unsigned thresh, unsigned chan=0);
60 
72  void Enqueue(unsigned count);
73 
90  void RawEnqueue(const void *data, unsigned count,
91  unsigned numChans, unsigned chanStride);
92 
99  void RawEnqueue(const void *data, unsigned count);
100 
101  void Flush();
102  bool Flushed() const;
103 
107  unsigned NumChannels() const;
108 
112  unsigned MaxThreshold() const;
113 
114  unsigned QueueLength() const;
121  unsigned Freespace() const;
122 
128  bool Full() const;
129 
135  unsigned ChannelStride() const;
136 
140  const std::string &GetDatatype() const;
141 
145  Key_t GetKey() const;
146 
151  void Release();
152 
154  void NotifyTerminate();
155 
156  shared_ptr<QueueBase> GetQueue() { return queue; }
157  private:
159  shared_ptr<QueueBase> queue;
160  };
161 
162 }
163 #endif
uint64_t Key_t
Definition: common.h:79
shared_ptr< QueueBase > queue
Definition: QueueWriter.h:159
shared_ptr< QueueBase > GetQueue()
Definition: QueueWriter.h:156
QueueReleaser * releaser
Definition: QueueWriter.h:158
#define CPN_API
Definition: common.h:36
Definition of the writer portion of the CPN queue class.
Definition: QueueWriter.h:37