00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023 #ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
00024 #define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
00025
00026 #include "dcmtk/oflog/config.h"
00027 #include "dcmtk/oflog/tstring.h"
00028 #include "dcmtk/oflog/helpers/lloguser.h"
00029
00030
00031 namespace log4cplus {
00032 namespace helpers {
00033
00037 class LOG4CPLUS_EXPORT SocketBuffer : protected log4cplus::helpers::LogLogUser
00038 {
00039 public:
00040 SocketBuffer(size_t max);
00041 SocketBuffer(const SocketBuffer& rhs);
00042 ~SocketBuffer();
00043
00044 SocketBuffer& operator=(const SocketBuffer& rhs);
00045
00046 char *getBuffer() const { return buffer; }
00047 size_t getMaxSize() const { return maxsize; }
00048 size_t getSize() const { return size; }
00049 void setSize(size_t s) { size = s; }
00050 size_t getPos() const { return pos; }
00051
00052 unsigned char readByte();
00053 unsigned short readShort();
00054 unsigned int readInt();
00055 tstring readString(unsigned char sizeOfChar);
00056
00057 void appendByte(unsigned char val);
00058 void appendShort(unsigned short val);
00059 void appendInt(unsigned int val);
00060 void appendSize_t(size_t val);
00061 void appendString(const tstring& str);
00062 void appendBuffer(const SocketBuffer& buffer);
00063
00064 private:
00065
00066 void copy(const SocketBuffer& rhs);
00067
00068
00069 size_t maxsize;
00070 size_t size;
00071 size_t pos;
00072 char *buffer;
00073 };
00074
00075 }
00076 }
00077
00078 #endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_
00079