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 
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 
84  static void setIniFilesDir(const char* iniFilesDir);
85 
87  explicit IniConfig(const char* iniFile);
88 
89  virtual ~IniConfig();
90 
91  IniConfig(const IniConfig& /*other*/) = delete; //< Disable the copy constructor.
92  IniConfig& operator=(const IniConfig& /*other*/) = delete; //< Disable the assignment operator.
93 
94  const char* iniFile() const;
95  const char* iniFilePath() const;
98  void reload();
99 
100 protected:
101  #define NX_INI_FLAG(DEFAULT, PARAM, DESCRIPTION) \
102  const bool PARAM = regBoolParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
103 
104  #define NX_INI_INT(DEFAULT, PARAM, DESCRIPTION) \
105  const int PARAM = regIntParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
106 
107  #define NX_INI_STRING(DEFAULT, PARAM, DESCRIPTION) \
108  const char* const PARAM = regStringParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
109 
110  #define NX_INI_FLOAT(DEFAULT, PARAM, DESCRIPTION) \
111  const float PARAM = regFloatParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
112 
113  #define NX_INI_DOUBLE(DEFAULT, PARAM, DESCRIPTION) \
114  const double PARAM = regDoubleParam(&PARAM, DEFAULT, #PARAM, DESCRIPTION)
115 
116 protected: // Used by macros.
117  bool regBoolParam(const bool* pValue, bool defaultValue,
118  const char* paramName, const char* description);
119 
120  int regIntParam(const int* pValue, int defaultValue,
121  const char* paramName, const char* description);
122 
123  const char* regStringParam(const char* const* pValue, const char* defaultValue,
124  const char* paramName, const char* description);
125 
126  float regFloatParam(const float* pValue, float defaultValue,
127  const char* paramName, const char* description);
128 
129  double regDoubleParam(const double* pValue, double defaultValue,
130  const char* paramName, const char* description);
131 
132 private:
133  class Impl;
134  Impl* const d;
135 };
136 
137 } // namespace kit
138 } // namespace nx
Definition: ini_config.h:57
Definition: debug.cpp:14
Definition: ini_config.cpp:405