subprocess  0.4.0
Modern subprocess library for c++
CowData.hpp
Go to the documentation of this file.
1 
2 #include <cstdint>
3 #include <memory>
4 
5 // experemnting with this to reduce amount of copies for some APIs
6 namespace subprocess {
7  class RefCount {
8  public:
9  int release() { return --mCount; }
10  int retain() { return ++mCount; }
11  int refCount() { return mCount; }
12  private:
13  int mCount=1;
14  };
15  class Data {
16  public:
17  typedef uint8_t byte;
18 
19  void reserve(ssize_t size);
20  private:
21  byte* mData = nullptr;
22  ssize_t mSize = 0;
23  ssize_t mCapacity = 0;
24  };
25  class CowData {
26  public:
27  typedef uint8_t data_type;
28  void reserve(ssize_t size) { mData.resize(size); }
29 
30  private:
31  std::shared_ptr<std::string> mData;
32  };
33 }
subprocess::ssize_t
intptr_t ssize_t
Definition: basic_types.hpp:21
subprocess
Definition: basic_types.hpp:19