3DiVi Face SDK  3.24.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups
Config.h
1 #ifndef __PBIO_API__PBIO__CONFIG_H_ea7a1512540d47be8a7663a585bcf973
2 #define __PBIO_API__PBIO__CONFIG_H_ea7a1512540d47be8a7663a585bcf973
3 
4 #include <string>
5 #include <vector>
6 #include <utility>
7 
8 
9 namespace pbio
10 {
11 
12 class FacerecService;
13 
19 class Config
20 {
21 public:
22 
28  Config(const std::string config_filepath);
29 
35  Config(const char* const config_filepath);
36 
65  const std::string parameter,
66  const double value);
67 
68 private:
69 
70  std::string config_filepath;
71 
72  std::vector<std::pair<std::string, double> > key_value;
73 
74  void prepare(
75  std::vector<char const*> &keys,
76  std::vector<double> &values) const;
77 
78  friend class FacerecService;
79 };
80 
81 } // pbio namespace
82 
83 
84 
85 
89 
90 
91 namespace pbio
92 {
93 
94 
95 inline
97  const std::string config_filepath) :
98 config_filepath(config_filepath)
99 {
100  // nothing else
101 }
102 
103 
104 inline
106  const char* const config_filepath) :
107 config_filepath(config_filepath)
108 {
109  // nothing else
110 }
111 
112 inline
114  const std::string parameter,
115  const double value)
116 {
117  key_value.push_back(std::make_pair(parameter, value));
118  return *this;
119 }
120 
121 inline
122 void Config::prepare(
123  std::vector<char const*> &keys,
124  std::vector<double> &values) const
125 {
126  keys.resize(key_value.size());
127  values.resize(key_value.size());
128 
129  for(size_t i = 0; i < key_value.size(); ++i)
130  {
131  keys[i] = key_value[i].first.c_str();
132  values[i] = key_value[i].second;
133  }
134 }
135 
136 
137 
138 } // pbio namespace
139 
140 
141 
142 #endif // __PBIO_API__PBIO__CONFIG_H_ea7a1512540d47be8a7663a585bcf973
Interface object for creating other interface objects.
Definition: FacerecService.h:64
A class used to override the configuration parameters at runtime.
Definition: Config.h:19
Config & overrideParameter(const std::string parameter, const double value)
Override the parameter value.
Definition: Config.h:113
Definition: FacerecService.mm:79
Config(const std::string config_filepath)
A constructor that takes the path to a configuration file.
Definition: Config.h:96