RSC  0.19.0
OptionBasedConfigurator.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of the RSC project.
4  *
5  * Copyright (C) 2012 by Johannes Wienke <jwienke at techfak dot uni-bielefeld dot de>
6  * Copyright (C) 2018 Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
7  *
8  * This file may be licensed under the terms of the
9  * GNU Lesser General Public License Version 3 (the ``LGPL''),
10  * or (at your option) any later version.
11  *
12  * Software distributed under the License is distributed
13  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14  * express or implied. See the LGPL for the specific language
15  * governing rights and limitations.
16  *
17  * You should have received a copy of the LGPL along with this
18  * program. If not, go to http://www.gnu.org/licenses/lgpl.html
19  * or write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * The development of this software was supported by:
23  * CoR-Lab, Research Institute for Cognition and Robotics
24  * Bielefeld University
25  *
26  * ============================================================ */
27 
28 #pragma once
29 
30 #include <vector>
31 #include <string>
32 
33 #include "../config/OptionHandler.h"
34 
35 #include "rsc/rscexports.h"
36 
37 namespace rsc {
38 namespace logging {
39 
52 public:
53 
60  OptionBasedConfigurator(const std::vector<std::string>& rootOption =
61  getDefaultRootOption());
62 
66  virtual ~OptionBasedConfigurator();
67 
73  static std::vector<std::string> getDefaultRootOption();
74 
81  std::vector<std::string> getRootOption() const;
82 
83  virtual void handleOption(const std::vector<std::string>& key,
84  const std::string& value);
85 
86 private:
87 
88  bool keyStartWithRoot(const std::vector<std::string>& key) const;
89  std::string loggerNameFromKey(const std::vector<std::string>& key) const;
90  std::string settingFromKey(const std::vector<std::string>& key) const;
91 
92  std::vector<std::string> normalizeKey(
93  const std::vector<std::string>& key) const;
94 
95  std::vector<std::string> rootOption;
96 
97 };
98 
99 }
100 }
Implementations of this interface receive options from ConfigSource objects.
Definition: OptionHandler.h:43
A class which configures the logging tree using configuration subsystem of RSC.