Remote Call Framework 3.3
ReallocBuffer.hpp
1 
2 //******************************************************************************
3 // RCF - Remote Call Framework
4 //
5 // Copyright (c) 2005 - 2022, Delta V Software. All rights reserved.
6 // https://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 under GPL terms.
12 //
13 // Version: 3.3
14 // Contact: support <at> deltavsoft.com
15 //
16 //******************************************************************************
17 
18 #ifndef INCLUDE_RCF_REALLOCBUFFER_HPP
19 #define INCLUDE_RCF_REALLOCBUFFER_HPP
20 
21 #include <memory>
22 
23 #include <RCF/Export.hpp>
24 
25 namespace RCF {
26 
27  class RCF_EXPORT ReallocBuffer
28  {
29  public:
30 
31  ReallocBuffer();
32  ReallocBuffer(std::size_t size);
33  ~ReallocBuffer();
34 
35  void clear();
36  void resize(std::size_t newSize);
37  std::size_t size();
38  std::size_t capacity();
39  bool empty();
40 
41  char * getPtr();
42  char & operator[](std::size_t pos);
43  const char & operator[](std::size_t pos) const;
44 
45  private:
46 
47  char * mpch;
48  std::size_t mSize;
49  std::size_t mCapacity;
50  };
51 
52  typedef std::shared_ptr<ReallocBuffer> ReallocBufferPtr;
53 
54 
55 } // namespace RCF
56 
57 #endif // ! INCLUDE_RCF_REALLOCBUFFER_HPP
Definition: AmiIoHandler.hpp:23