stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
ini_config.h
1 #pragma once
2 
3 #include <iostream>
4 
5 #if !defined(NX_KIT_API)
6  #define NX_KIT_API
7 #endif
8 
9 namespace nx {
10 namespace kit {
11 
57 class NX_KIT_API IniConfig
58 {
59 public:
65  static bool isEnabled();
66 
73  static void setOutput(std::ostream* output);
74 
76  static const char* iniFilesDir();
77 
85  static void setIniFilesDir(const char* iniFilesDir);
86 
88  explicit IniConfig(const char* iniFile);
89 
90  virtual ~IniConfig();
91 
92  IniConfig(const IniConfig& /*other*/) = delete; //< Disable the copy constructor.
93  IniConfig& operator=(const IniConfig& /*other*/) = delete; //< Disable the assignment operator.
94 
95  const char* iniFile() const;
96  const char* iniFilePath() const;
99  void reload();
100 
101 protected:
102  #define NX_INI_FLAG(DEFAULT, PARAM, DESCRIPTION) \
103  const bool PARAM = regBoolParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
104 
105  #define NX_INI_INT(DEFAULT, PARAM, DESCRIPTION) \
106  const int PARAM = regIntParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
107 
108  #define NX_INI_STRING(DEFAULT, PARAM, DESCRIPTION) \
109  const char* const PARAM = regStringParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
110 
111  #define NX_INI_FLOAT(DEFAULT, PARAM, DESCRIPTION) \
112  const float PARAM = regFloatParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
113 
114  #define NX_INI_DOUBLE(DEFAULT, PARAM, DESCRIPTION) \
115  const double PARAM = regDoubleParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
116 
117 protected: // Used by macros.
118  bool regBoolParam(const bool* pValue, bool defaultValue,
119  const char* paramName, const char* description);
120 
121  int regIntParam(const int* pValue, int defaultValue,
122  const char* paramName, const char* description);
123 
124  const char* regStringParam(const char* const* pValue, const char* defaultValue,
125  const char* paramName, const char* description);
126 
127  float regFloatParam(const float* pValue, float defaultValue,
128  const char* paramName, const char* description);
129 
130  double regDoubleParam(const double* pValue, double defaultValue,
131  const char* paramName, const char* description);
132 
133 private:
134  class Impl;
135  Impl* const d;
136 };
137 
138 } // namespace kit
139 } // namespace nx
Definition: ini_config.h:57
Definition: debug.cpp:12
Definition: ini_config.cpp:404