PTLib  Version 2.10.11
qchannel.h
Go to the documentation of this file.
1 /*
2  * qchannel.h
3  *
4  * Class for implementing a serial queue channel in memory.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 2001 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 24177 $
27  * $Author: rjongbloed $
28  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
29  */
30 
31 #ifndef PTLIB_QCHANNEL_H
32 #define PTLIB_QCHANNEL_H
33 
34 
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38 
39 
53 class PQueueChannel : public PChannel
54 {
55  PCLASSINFO(PQueueChannel, PChannel);
56  public:
62  PINDEX queueSize = 0
63  );
64 
69 
70 
84  virtual PBoolean Read(
85  void * buf,
86  PINDEX len
87  );
88 
98  virtual PBoolean Write(
99  const void * buf,
100  PINDEX len
101  );
102 
106  virtual PBoolean Close();
108 
109 
114  virtual PBoolean Open(
115  PINDEX queueSize
116  );
117 
119  PINDEX GetSize() const { return queueSize; }
120 
122  PINDEX GetLength() const { return queueLength; }
124 
125  protected:
127  BYTE * queueBuffer;
131 };
132 
133 
134 #endif // PTLIB_QCHANNEL_H
135 
136 
137 // End Of File ///////////////////////////////////////////////////////////////
PQueueChannel(PINDEX queueSize=0)
Create a new queue channel with the specified maximum size.
PSyncPoint unempty
Definition: qchannel.h:129
PINDEX queueSize
Definition: qchannel.h:128
PINDEX GetSize() const
Get the queue size.
Definition: qchannel.h:119
~PQueueChannel()
Delete queue and release memory used.
PMutex mutex
Definition: qchannel.h:126
PINDEX dequeuePos
Definition: qchannel.h:128
PINDEX queueLength
Definition: qchannel.h:128
virtual PBoolean Open(PINDEX queueSize)
Open a queue, allocating the queueSize bytes.
PSyncPoint unfull
Definition: qchannel.h:130
BOOL PBoolean
Definition: object.h:102
PINDEX enqueuePos
Definition: qchannel.h:128
PINDEX GetLength() const
Get the current queue length.
Definition: qchannel.h:122
virtual PBoolean Read(void *buf, PINDEX len)
Low level read from the file channel.
BYTE * queueBuffer
Definition: qchannel.h:127
Abstract class defining I/O channel semantics.
Definition: channel.h:107
Class for implementing a serial queue channel in memory.
Definition: qchannel.h:53
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the file channel.
virtual PBoolean Close()
Close the file channel.
Synonym for PTimedMutex.
This class defines a thread synchronisation object.
Definition: syncpoint.h:67