OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 version(const std::string& version);
25 
26  void key(const std::string& string);
27 
28  template <typename T>
29  inline void plainText(const T& value)
30  {
31  mOfstream << value;
32  }
33 
34  inline void comma()
35  {
36  mOfstream << ",";
37  }
38 
39  void enter();
40 
41  private:
42  const bool mHumanReadable;
43  long long mBracesCounter;
44  long long mBracketsCounter;
45  std::ofstream mOfstream;
46 
48  };
49 }
50 
51 #endif // OPENPOSE_FILESTREAM_JSON_OFSTREAM_HPP
#define DELETE_COPY(className)
Definition: macros.hpp:30
Definition: jsonOfstream.hpp:9
void plainText(const T &value)
Definition: jsonOfstream.hpp:29
void comma()
Definition: jsonOfstream.hpp:34
#define OP_API
Definition: macros.hpp:15
std::string string
Definition: cl2.hpp:574