OFFIS DCMTK  Version 3.6.0
sockbuff.h
Go to the documentation of this file.
1 // Module: Log4CPLUS
2 // File: socketbuffer.h
3 // Created: 5/2003
4 // Author: Tad E. Smith
5 //
6 //
7 // Copyright 2003-2009 Tad E. Smith
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 
23 #ifndef LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
24 #define LOG4CPLUS_HELPERS_SOCKET_BUFFER_HEADER_
25 
26 #include "dcmtk/oflog/config.h"
27 #include "dcmtk/oflog/tstring.h"
29 
30 
31 namespace log4cplus {
32  namespace helpers {
33 
37  class LOG4CPLUS_EXPORT SocketBuffer : protected log4cplus::helpers::LogLogUser
38  {
39  public:
40  SocketBuffer(size_t max);
41  SocketBuffer(const SocketBuffer& rhs);
42  ~SocketBuffer();
43 
44  SocketBuffer& operator=(const SocketBuffer& rhs);
45 
46  char *getBuffer() const { return buffer; }
47  size_t getMaxSize() const { return maxsize; }
48  size_t getSize() const { return size; }
49  void setSize(size_t s) { size = s; }
50  size_t getPos() const { return pos; }
51 
52  unsigned char readByte();
53  unsigned short readShort();
54  unsigned int readInt();
55  tstring readString(unsigned char sizeOfChar);
56 
57  void appendByte(unsigned char val);
58  void appendShort(unsigned short val);
59  void appendInt(unsigned int val);
60  void appendSize_t(size_t val);
61  void appendString(const tstring& str);
62  void appendBuffer(const SocketBuffer& buffer);
63 
64  private:
65  // Methods
66  void copy(const SocketBuffer& rhs);
67 
68  // Data
69  size_t maxsize;
70  size_t size;
71  size_t pos;
72  char *buffer;
73  };
74 
75  } // end namespace helpers
76 } // end namespace log4cplus
77 
78 #endif // LOG4CPLUS_HELPERS_SOCKET_HEADER_
79 


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2