00001
00002
00003
00004
00005
00006
00007
00010 #if !defined(H_DC_BUFFER)
00011 #define H_DC_BUFFER
00012
00013 #include "lib/dc_memory.h"
00014
00016
00033 class DC_Buffer_t : public MemoryBuf {
00034 friend ostream &operator<<(ostream &os, DC_Buffer_t &buf);
00035 friend class DC_PipeInStream_t;
00036 friend class DC_PipeOutStream_t;
00037 friend class DC_ReaderServerLoop;
00038 friend class DC_StreamBufferQueue;
00039 friend class DC_RemoteOutStreamCopy;
00040 private:
00041 enum { DATA=0, EOS, EOW } eType;
00042 bool fConsume;
00043
00044 public:
00046 DC_Buffer_t *pNext;
00047
00048 public:
00049 DC_Buffer_t(void) : eType(DATA), fConsume(true) {};
00050 DC_Buffer_t(int wMax)
00051 : MemoryBuf(wMax), eType(DATA), fConsume(true) {};
00052 DC_Buffer_t(char *pBuf, int wMax, int wSize)
00053 : MemoryBuf(pBuf, wMax, wSize), eType(DATA), fConsume(false) {};
00054 DC_Buffer_t(const DC_Buffer_t &buf);
00055
00056
00057
00058
00060
00065 #if 1
00066 void consume(void) { if (fConsume) delete this; };
00067 #else
00068 void consume(void) {
00069 size=-1;
00070 max=-1;
00071 pBuf=0;
00072 if (fConsume) delete this;
00073 };
00074 #endif
00075
00076 bool getConsume(void) { return fConsume; };
00078 void setConsume(bool fConsume_in) { fConsume=fConsume_in; };
00079
00080
00081 #if 0 // These fcns are all available from the base class
00082
00083 char *New(Types::uint wMax_in);
00085 void Delete(void);
00086 void Set(char *pBuf_in, int wMax_in, int wSize_in, bool fFree_in);
00088 void Empty(void);
00090 Types::uint getMax(void);
00092 char *getPtr(void);
00094 Types::uint getSize(void);
00096 Types::uint getFree(void);
00098 char *getPtrFree(void);
00099
00100 char *getPtrExtract(void);
00102 Types::uint getSizeExtract(void);
00104 Types::uint resetExtract(Types::uint w=0);
00106 Types::uint setSize(Types::uint wSize_in);
00108 int setSize(Types::uint size);
00110 char *Append(char *p, Types::uint size);
00112 char *Append(<type>);
00114 int sprintf(char *format, ...);
00115
00116 int Extract(char *p, Types::uint size);
00117
00118 int Extract(*<type>);
00119 #endif
00120 };
00121
00122 #endif