PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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: 28755 $
27 * $Author: rjongbloed $
28 * $Date: 2013-01-03 17:36:28 +1100 (Thu, 03 Jan 2013) $
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:
61 PQueueChannel(
62 PINDEX queueSize = 0
63 );
64
67 ~PQueueChannel();
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:
126 PMutex mutex;
127 BYTE * queueBuffer;
128 PINDEX queueSize, queueLength, enqueuePos, dequeuePos;
129 PSyncPoint unempty;
130 PSyncPoint unfull;
131 };
132
133
134 #endif // PTLIB_QCHANNEL_H
135
136
137 // End Of File ///////////////////////////////////////////////////////////////