OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
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 
14  ~JsonOfstream();
15 
16  void objectOpen();
17 
18  void objectClose();
19 
20  void arrayOpen();
21 
22  void arrayClose();
23 
24  void key(const std::string& string);
25 
26  template <typename T>
27  inline void plainText(const T& value)
28  {
29  mOfstream << value;
30  }
31 
32  inline void comma()
33  {
34  mOfstream << ",";
35  }
36 
37  void enter();
38 
39  private:
40  const bool mHumanReadable;
41  long long mBracesCounter;
42  long long mBracketsCounter;
43  std::ofstream mOfstream;
44 
46  };
47 }
48 
49 #endif // OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:25
Definition: jsonOfstream.hpp:9
void plainText(const T &value)
Definition: jsonOfstream.hpp:27
void comma()
Definition: jsonOfstream.hpp:32
#define OP_API
Definition: macros.hpp:5