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