Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

funneldevice.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     funneldevice.h  -  Definition of the FunnelDevice class.
00003                              -------------------
00004     begin                : June 21 2002
00005     copyright            : (C) 2003 by Vojtìch Toman
00006     email                : vtoman@lit.cz
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00026 #ifdef __GNUG__
00027 # pragma interface
00028 #endif
00029 
00030 #ifndef CHANNELDEVICE_H
00031 #define CHANNELDEVICE_H
00032 
00033 #include "defs.h"
00034 #include "debug.h"
00035 #include "exceptions.h"
00036 #include "iodevice.h"
00037 #include "xmldefs.h"
00038 
00039 
00040 
00042 #define DEFAULT_FUNNEL_BUFFER_SIZE      4098
00043 
00044 
00045 class UserOfFunnelDevice;
00046 
00047 
00048 
00058 class FunnelDevice : public IODevice
00059 {
00060 public:
00062   FunnelDevice(UserOfFunnelDevice *rcvr, bool isImmediate = false, size_t size = DEFAULT_FUNNEL_BUFFER_SIZE);
00063 
00065   virtual ~FunnelDevice(void);
00066 
00068   virtual void prepare(void) throw (ExaltIOException);
00069 
00071   virtual void flush(void) throw (ExaltIOException);
00072 
00074   virtual void finish(void) throw (ExaltIOException);
00075 
00077   virtual IOState readData(char *buf, IOSize length) throw (ExaltIOException);
00078 
00080   virtual IOState getChar(int *) throw (ExaltIOException);
00081 
00083   virtual IOState writeData(const char *buf, IOSize length) throw (ExaltIOException);
00084 
00086   virtual IOState putChar(int) throw (ExaltIOException);
00087 
00089   virtual IOSize bytesReadTotal(void);
00090 
00092   virtual IOSize bytesRead(void);
00093 
00095   virtual IOSize bytesWritten(void);
00096 
00098   virtual bool errorOccurred(void);
00099 
00101   virtual bool eof(void);
00102 
00103 protected:
00105   UserOfFunnelDevice *receiver;
00106 
00108   size_t bufferSize;
00109 
00111   size_t dataLength;
00112 
00114   bool dataPresent;
00115 
00117   bool immediate;
00118 
00120   IOSize bw;
00121 
00123   XmlChar *buffer;
00124 };
00125 
00126 
00132 class UserOfFunnelDevice
00133 {
00134 public:
00143   virtual void receiveData(XmlChar *data, size_t size) = 0;
00144 };
00145 
00146 
00147 
00148 
00149 #endif //FUNNELDEVICE_H

Generated on Wed Feb 5 10:43:01 2003 for Exalt by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002