stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
to_string.h
1 #pragma once
2 
3 #include <string>
4 #include <ostream>
5 
6 #include <nx/sdk/error.h>
7 #include <nx/sdk/i_string_map.h>
8 #include <nx/sdk/i_device_info.h>
9 
10 namespace nx {
11 namespace sdk {
12 
22 std::string toJsonString(const IStringMap* map, int overallIndent = 0);
23 
25 std::string toJsonString(const IDeviceInfo* deviceInfo, int overallIndent = 0);
26 
27 inline const char* toString(Error error)
28 {
29  switch (error)
30  {
31  case Error::noError: return "noError";
32  case Error::unknownError: return "unknownError";
33  case Error::networkError: return "networkError";
34  default: return "<unsupported Error>";
35  }
36 }
37 
38 } // namespace sdk
39 } // namespace nx
40 
41 //-------------------------------------------------------------------------------------------------
42 // Functions that need to be in namespace std for compatibility with STL features.
43 
44 namespace std {
45 
46 inline std::ostream& operator<<(std::ostream& os, nx::sdk::Error error)
47 {
48  return os << toString(error);
49 }
50 
51 } // namespace std
Definition: to_string.h:44
Definition: debug.cpp:12