All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConfigManager.h
Go to the documentation of this file.
1 /**
2  * \file ConfigManager.h
3  *
4  * \ingroup Base
5  *
6  * \brief Class def header for a class flashmatch::ConfigManager
7  *
8  * @author drinkingkazu
9  */
10 
11 /** \addtogroup core_Base
12 
13  @{*/
14 #ifndef __FLASHMATCHBASE_CONFIGMANAGER_H__
15 #define __FLASHMATCHBASE_CONFIGMANAGER_H__
16 
17 #include <iostream>
18 #include "PSet.h"
19 #include <set>
20 
21 namespace flashmatch {
22  /**
23  \class ConfigManager
24  \brief Utility class to register a set of configurations
25  Provides also a shared instance through which registered configurations can be shared beyond a single owner.\n
26  Using flashmatch::PSet, the uniqueness of configuration parameters is guaranteed (no worry to "overwrite")\n
27  */
28  class ConfigManager {
29 
30  public:
31 
32  /// Default constructor
34 
35  /// Default destructor
37  /// Shared static reference getter
38  static const ConfigManager& get()
39  {
40  if(!_me) _me = new ConfigManager;
41  return *_me;
42  }
43  /// Adder of configuration from a file
44  void AddConfigFile(const std::string cfg_file);
45  /// Adder of configuration from parsed string
46  void AddConfigString(const std::string cfg_str);
47  /// Configuration retrieval method
48  const PSet& GetConfig(const std::string cfg);
49 
50  private:
51 
52  static ConfigManager* _me;
53  std::set<std::string> _cfg_files;
55 
56  };
57 }
58 #endif
59 /** @} */ // end of doxygen group
60 
Utility class to register a set of configurations Provides also a shared instance through which regis...
Definition: ConfigManager.h:28
std::set< std::string > _cfg_files
Definition: ConfigManager.h:53
static ConfigManager * _me
Definition: ConfigManager.h:52
void AddConfigString(const std::string cfg_str)
Adder of configuration from parsed string.
void AddConfigFile(const std::string cfg_file)
Adder of configuration from a file.
ConfigManager()
Default constructor.
Definition: ConfigManager.h:33
~ConfigManager()
Default destructor.
Definition: ConfigManager.h:36
const PSet & GetConfig(const std::string cfg)
Configuration retrieval method.
Class def header for a class flashmatch::PSet.
A nested configuration parameter set holder for flashmatch framework.
Definition: PSet.h:26