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
indchan.h
Go to the documentation of this file.
1 /*
2 * indchan.h
3 *
4 * Indirect I/O channel class.
5 *
6 * Portable Windows Library
7 *
8 * Copyright (c) 1993-1998 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 * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
25 * All Rights Reserved.
26 *
27 * Contributor(s): ______________________________________.
28 *
29 * $Revision: 26934 $
30 * $Author: rjongbloed $
31 * $Date: 2012-02-03 14:32:00 +1100 (Fri, 03 Feb 2012) $
32 */
33
34 #ifndef PTLIB_INDIRECTCHANNEL_H
35 #define PTLIB_INDIRECTCHANNEL_H
36
37 #ifdef P_USE_PRAGMA
38 #pragma interface
39 #endif
40
41 #include <ptlib/channel.h>
42 #include <ptlib/syncthrd.h>
43
49 class PIndirectChannel : public PChannel
50 {
51 PCLASSINFO(PIndirectChannel, PChannel);
52
53 public:
60 PIndirectChannel();
61
63 ~PIndirectChannel();
65
66
75 Comparison Compare(
76 const PObject & obj
77 ) const;
79
80
90 virtual PString GetName() const;
91
98 virtual PBoolean Close();
99
107 virtual PBoolean IsOpen() const;
108
124 virtual PBoolean Read(
125 void * buf,
126 PINDEX len
127 );
128
143 virtual PBoolean Write(
144 const void * buf,
145 PINDEX len
146 );
147
156 virtual PBoolean Shutdown(
157 ShutdownValue option
158 );
159
167 virtual bool SetLocalEcho(
168 bool localEcho
169 );
170
171
180 virtual PChannel * GetBaseReadChannel() const;
181
190 virtual PChannel * GetBaseWriteChannel() const;
191
197 virtual PString GetErrorText(
198 ErrorGroup group = NumErrorGroups
199 ) const;
201
211 PBoolean Open(
212 PChannel & channel
213 );
214
225 PBoolean Open(
226 PChannel * channel,
227 PBoolean autoDelete = true
228 );
229
241 PBoolean Open(
242 PChannel * readChannel,
243 PChannel * writeChannel,
244 PBoolean autoDeleteRead = true,
245 PBoolean autoDeleteWrite = true
246 );
247
253 PChannel * GetReadChannel() const;
254
260 bool SetReadChannel(
261 PChannel * channel,
262 bool autoDelete = true,
263 bool closeExisting = false
264 );
265
271 PChannel * GetWriteChannel() const;
272
278 PBoolean SetWriteChannel(
279 PChannel * channel,
280 bool autoDelete = true,
281 bool closeExisting = false
282 );
284
285
286 protected:
296 virtual PBoolean OnOpen();
297
298
299 // Member variables
301 PChannel * readChannel;
302
304 PBoolean readAutoDelete;
305
307 PChannel * writeChannel;
308
310 PBoolean writeAutoDelete;
311
313 PReadWriteMutex channelPointerMutex;
314 };
315
316
317 #endif // PTLIB_INDIRECTCHANNEL_H
318
319
320 // End Of File ///////////////////////////////////////////////////////////////