RCFProto

- Main Page
- Classes
- Files

- File List

All Classes Functions Typedefs
ReallocBuffer.hpp
1
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2013, Delta V Software. All rights reserved.
6 // http://www.deltavsoft.com
7 //
8 // RCF is distributed under dual licenses - closed source or GPL.
9 // Consult your particular license for conditions of use.
10 //
11 // If you have not purchased a commercial license, you are using RCF
12 // under GPL terms.
13 //
14 // Version: 2.0
15 // Contact: support <at> deltavsoft.com
16 //
17 //******************************************************************************
18
19 #ifndef INCLUDE_RCF_REALLOCBUFFER_HPP
20 #define INCLUDE_RCF_REALLOCBUFFER_HPP
21
22 #include <boost/shared_ptr.hpp>
23
24 #include <RCF/Export.hpp>
25
26 namespace RCF {
27
28 class RCF_EXPORT ReallocBuffer
29 {
30 public:
31
32 ReallocBuffer();
33 ReallocBuffer(std::size_t size);
34 ~ReallocBuffer();
35
36 void clear();
37 void resize(std::size_t newSize);
38 std::size_t size();
39 std::size_t capacity();
40 bool empty();
41
42 char * getPtr();
43 char & operator[](std::size_t pos);
44 const char & operator[](std::size_t pos) const;
45
46 private:
47
48 char * mpch;
49 std::size_t mSize;
50 std::size_t mCapacity;
51 };
52
53 typedef boost::shared_ptr<ReallocBuffer> ReallocBufferPtr;
54
55
56 } // namespace RCF
57
58 #endif // ! INCLUDE_RCF_REALLOCBUFFER_HPP