Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

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  * $Log: qchannel.h,v $
00027  * Revision 1.3  2004/11/11 07:34:50  csoutheren
00028  * Added #include <ptlib.h>
00029  *
00030  * Revision 1.2  2002/09/16 01:08:59  robertj
00031  * Added #define so can select if #pragma interface/implementation is used on
00032  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00033  *
00034  * Revision 1.1  2001/07/10 03:07:07  robertj
00035  * Added queue channel and delay channel classes to ptclib.
00036  *
00037  */
00038 
00039 #ifndef _QCHANNEL_H
00040 #define _QCHANNEL_H
00041 
00042 
00043 #ifdef P_USE_PRAGMA
00044 #pragma interface
00045 #endif
00046 
00047 #include <ptlib.h>
00048 
00062 class PQueueChannel : public PChannel
00063 {
00064     PCLASSINFO(PQueueChannel, PChannel);
00065   public:
00070     PQueueChannel(
00071       PINDEX queueSize = 0   
00072     );
00073 
00076     ~PQueueChannel();
00078 
00079 
00093     virtual BOOL Read(
00094       void * buf,   
00095       PINDEX len    
00096     );
00097 
00107     virtual BOOL Write(
00108       const void * buf, 
00109       PINDEX len        
00110     );
00111 
00115     virtual BOOL Close();
00117 
00118 
00123     virtual BOOL Open(
00124       PINDEX queueSize   
00125     );
00126 
00128     PINDEX GetSize() const { return queueSize; }
00129 
00131     PINDEX GetLength() const { return queueLength; }
00133 
00134   protected:
00135     PMutex     mutex;
00136     BYTE     * queueBuffer;
00137     PINDEX     queueSize, queueLength, enqueuePos, dequeuePos;
00138     PSyncPoint unempty;
00139     PSyncPoint unfull;
00140 };
00141 
00142 
00143 #endif // _QCHANNEL_H
00144 
00145 
00146 // End Of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 21 20:43:09 2005 for PWLib by  doxygen 1.4.1