humoto
config_yaml.h
Go to the documentation of this file.
1 /**
2  @file
3  @author Alexander Sherikov
4  @author Jan Michalczyk
5  @copyright 2014-2017 INRIA. Licensed under the Apache License, Version 2.0.
6  (see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7 
8  @brief
9 
10  @note Headers with the implementation are included in 'config.h'.
11 */
12 
13 #pragma once
14 
15 #ifdef HUMOTO_CONFIG_DISABLED
16  #error "This header must be included before humoto.h"
17 #else
18 
19  #include "humoto_helpers.h"
20 
21  #include "yaml-cpp/yaml.h"
22 
23  #include "config_yaml/reader.h"
24  #include "config_yaml/writer.h"
25 
26 
27  namespace humoto
28  {
29  namespace config
30  {
31  /**
32  * @brief YAML bridge namespace.
33  */
34  namespace yaml
35  {
39  #endif
40  {
41  protected:
42  #ifdef HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT
43  using HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT::writeConfigEntries;
44  using HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT::readConfigEntries;
45  #endif
46 
47  ///@{
48  /**
49  * @attention Implementations of these methods are added
50  * automatically upon inclusion of define_accessors.h.
51  */
52  virtual void writeConfigEntries(humoto::config::yaml::Writer &) const = 0;
53  virtual void readConfigEntries(humoto::config::yaml::Reader &, const bool) = 0;
54  ///@}
55  };
56 
57  #ifdef HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT
58  #undef HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT
59  #endif
60  #define HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT humoto::config::yaml::ConfigurableBase
61  }
62  }
63  }
64 
65  #define HUMOTO_BRIDGE_config_yaml_DEFINITIONS \
66  protected: \
67  void writeConfigEntries(humoto::config::yaml::Writer & writer) const \
68  { \
69  writeConfigEntriesTemplate(writer); \
70  }\
71  void readConfigEntries(humoto::config::yaml::Reader & reader, const bool crash_flag)\
72  {\
73  readConfigEntriesTemplate(reader, crash_flag);\
74  }
75 
76 
77  #ifndef HUMOTO_USE_CONFIG
78  #define HUMOTO_USE_CONFIG
79  #endif
80 #endif
virtual void writeConfigEntries(humoto::config::yaml::Writer &) const =0
Configuration reader class.
Definition: reader.h:22
Very basic definitions.
Configuration writer class.
Definition: writer.h:22
The root namespace of HuMoTo.
Definition: config.h:12
#define HUMOTO_CONFIG_CONFIGURABLE_BASE_PARENT
Definition: config_yaml.h:60
virtual void readConfigEntries(humoto::config::yaml::Reader &, const bool)=0