OpenPose  1.7.0
The first real-time multi-person system to jointly detect human body, hand, facial, and foot keypoints
jsonOfstream.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP
2 #define OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP
3 
4 #include <fstream> // std::ofstream
6 
7 namespace op
8 {
10  {
11  public:
12  explicit JsonOfstream(const std::string& filePath, const bool humanReadable = true);
13 
19  JsonOfstream(JsonOfstream&& jsonOfstream);
20 
28 
29  virtual ~JsonOfstream();
30 
31  void objectOpen();
32 
33  void objectClose();
34 
35  void arrayOpen();
36 
37  void arrayClose();
38 
39  void version(const std::string& version);
40 
41  void key(const std::string& string);
42 
43  template <typename T>
44  inline void plainText(const T& value)
45  {
46  *upOfstream << value;
47  }
48 
49  inline void comma()
50  {
51  *upOfstream << ",";
52  }
53 
54  void enter();
55 
56  private:
57  bool mHumanReadable;
58  long long mBracesCounter;
59  long long mBracketsCounter;
60  std::unique_ptr<std::ofstream> upOfstream; // std::unique_ptr to solve std::move issue in GCC < 5
61 
63  };
64 }
65 
66 #endif // OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP
virtual ~JsonOfstream()
void version(const std::string &version)
void plainText(const T &value)
JsonOfstream(JsonOfstream &&jsonOfstream)
void key(const std::string &string)
JsonOfstream(const std::string &filePath, const bool humanReadable=true)
JsonOfstream & operator=(JsonOfstream &&jsonOfstream)
#define OP_API
Definition: macros.hpp:18
#define DELETE_COPY(className)
Definition: macros.hpp:32