Reinforcement Learning  1.1
configuration.h
Go to the documentation of this file.
1 
8 #pragma once
9 #include <string>
10 #include <unordered_map>
11 
12 namespace reinforcement_learning
13 {
14 namespace utility
15 {
16 class configuration;
17 }
18 } // namespace reinforcement_learning
19 
20 std::ostream& operator<<(std::ostream& os, const reinforcement_learning::utility::configuration&);
21 
22 namespace reinforcement_learning
23 {
24 namespace utility
25 {
31 {
32 public:
33  configuration() = default;
34  ~configuration() = default;
36  configuration(const configuration&) = default;
43 
45  void set(const char* name, const char* value);
47  const char* get(const char* name, const char* defval) const;
49  int get_int(const char* name, int defval) const;
51  bool get_bool(const char* name, bool defval) const;
53  float get_float(const char* name, float defval) const;
55  friend std::ostream& ::operator<<(std::ostream& os, const reinforcement_learning::utility::configuration&);
56 
59  bool get_bool(const char* section, const char* name, bool defval) const;
60 
61 private:
62  using map_type = std::unordered_map<std::string, std::string>;
63  map_type _pmap;
64 };
65 } // namespace utility
66 } // namespace reinforcement_learning
Configuration class to initialize the API Represents a collection of (name,value) pairs used to confi...
Definition: configuration.h:31
configuration & operator=(configuration &&)=default
Move constructor.
int get_int(const char *name, int defval) const
Gets the value as an integer. If the value does not exist or if there is an error,...
configuration & operator=(const configuration &)=default
Assignment operator.
float get_float(const char *name, float defval) const
Gets the value as a float. If the value does not exist or if there is an error, it returns defval.
configuration(const configuration &)=default
Copy constructor.
void set(const char *name, const char *value)
Sets the value for a given name. It overrides any existing values for that name.
bool get_bool(const char *section, const char *name, bool defval) const
bool get_bool(const char *name, bool defval) const
Gets the value as a boolean. If the value does not exist or if there is an error, it returns defval.
const char * get(const char *name, const char *defval) const
Gets the value for a given name. If the value does not exist, it returns defval.
configuration(configuration &&)=default
Move assignment operator.
[Error Generator]
Definition: live_model.h:25
reinforcement_learning::status_builder & operator<<(reinforcement_learning::status_builder &sbuilder, const T &val)
left shift operator to serialize types into stringstream held in status_builder
Definition: api_status.h:160