Nymph  v1.5.2
Flow-Based Data Processing Framework
KTConfigurator.hh
Go to the documentation of this file.
1 /*
2  * KTConfigurator.hh
3  *
4  * Created on: Nov 5, 2013
5  * Author: nsoblath
6  */
7 
8 #ifndef KTCONFIGURATOR_HH_
9 #define KTCONFIGURATOR_HH_
10 
11 #include "singleton.hh"
12 #include "param.hh"
13 
14 #include "KTException.hh"
15 
16 #include <string>
17 
18 namespace Nymph
19 {
20 
21  class KTConfigurator : public scarab::singleton< KTConfigurator >
22  {
23  private:
24  friend class scarab::singleton< KTConfigurator >;
25  friend class scarab::destroyer< KTConfigurator >;
26 
28  virtual ~KTConfigurator();
29 
30  public:
31  void Merge(const scarab::param_node& aNode);
32 
33  scarab::param_node& Config();
34  const scarab::param_node& Config() const;
35 
36  template< typename XReturnType >
37  XReturnType Get( const std::string& aName ) const;
38 
39  template< typename XReturnType >
40  XReturnType Get( const std::string& aName, XReturnType aDefault ) const;
41 
42  private:
43  scarab::param_node fMasterConfig;
44 
45  std::string fStringBuffer;
46  };
47 
48  template< typename XReturnType >
49  XReturnType KTConfigurator::Get( const std::string& aName ) const
50  {
51  return fMasterConfig[ aName ]().as< XReturnType >();
52  }
53 
54  template< typename XReturnType >
55  XReturnType KTConfigurator::Get( const std::string& aName, XReturnType aDefault ) const
56  {
57  return fMasterConfig.get_value< XReturnType >( aName, aDefault );
58  }
59 
60  inline void KTConfigurator::Merge(const scarab::param_node& aNode)
61  {
62  fMasterConfig.merge(aNode);
63  return;
64  }
65 
66  inline scarab::param_node& KTConfigurator::Config()
67  {
68  return fMasterConfig;
69  }
70 
71  inline const scarab::param_node& KTConfigurator::Config() const
72  {
73  return fMasterConfig;
74  }
75 
76 
77 } /* namespace Nymph */
78 #endif /* KTCONFIGURATOR_HH_ */
scarab::param_node fMasterConfig
void Merge(const scarab::param_node &aNode)
XReturnType Get(const std::string &aName) const
scarab::param_node & Config()