oflog/include/dcmtk/oflog/helpers/sockbuff.h

Go to the documentation of this file.
00001 // Module:  Log4CPLUS
00002 // File:    socketbuffer.h
00003 // Created: 5/2003
00004 // Author:  Tad E. Smith
00005 //
00006 //
00007 // Copyright 2003-2009 Tad E. Smith
00008 //
00009 // Licensed under the Apache License, Version 2.0 (the "License");
00010 // you may not use this file except in compliance with the License.
00011 // You may obtain a copy of the License at
00012 //
00013 //     http://www.apache.org/licenses/LICENSE-2.0
00014 //
00015 // Unless required by applicable law or agreed to in writing, software
00016 // distributed under the License is distributed on an "AS IS" BASIS,
00017 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018 // See the License for the specific language governing permissions and
00019 // limitations under the License.
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           // Methods
00066             void copy(const SocketBuffer& rhs);
00067 
00068           // Data
00069             size_t maxsize;
00070             size_t size;
00071             size_t pos;
00072             char *buffer;
00073         };
00074 
00075     } // end namespace helpers
00076 } // end namespace log4cplus
00077 
00078 #endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_
00079 


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1