qchannel.h

Go to the documentation of this file.
00001 /*
00002  * qchannel.h
00003  *
00004  * Class for implementing a serial queue channel in memory.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 2001 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Contributor(s): ______________________________________.
00025  *
00026  * $Revision: 21788 $
00027  * $Author: rjongbloed $
00028  * $Date: 2008-12-11 23:42:13 -0600 (Thu, 11 Dec 2008) $
00029  */
00030 
00031 #ifndef PTLIB_QCHANNEL_H
00032 #define PTLIB_QCHANNEL_H
00033 
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 
00053 class PQueueChannel : public PChannel
00054 {
00055     PCLASSINFO(PQueueChannel, PChannel);
00056   public:
00061     PQueueChannel(
00062       PINDEX queueSize = 0   
00063     );
00064 
00067     ~PQueueChannel();
00069 
00070 
00084     virtual PBoolean Read(
00085       void * buf,   
00086       PINDEX len    
00087     );
00088 
00098     virtual PBoolean Write(
00099       const void * buf, 
00100       PINDEX len        
00101     );
00102 
00106     virtual PBoolean Close();
00108 
00109 
00114     virtual PBoolean Open(
00115       PINDEX queueSize   
00116     );
00117 
00119     PINDEX GetSize() const { return queueSize; }
00120 
00122     PINDEX GetLength() const { return queueLength; }
00124 
00125   protected:
00126     PMutex     mutex;
00127     BYTE     * queueBuffer;
00128     PINDEX     queueSize, queueLength, enqueuePos, dequeuePos;
00129     PSyncPoint unempty;
00130     PSyncPoint unfull;
00131 };
00132 
00133 
00134 #endif // PTLIB_QCHANNEL_H
00135 
00136 
00137 // End Of File ///////////////////////////////////////////////////////////////

Generated on Thu May 27 01:36:48 2010 for PTLib by  doxygen 1.4.7