ConfigUtils.h
Go to the documentation of this file.
1 #ifndef _utl_ConfigUtils_h_
2 #define _utl_ConfigUtils_h_
3 
4 #include <utl/Branch.h>
5 
6 
7 namespace utl {
8 
32  template<class T1, class T2>
33  inline
34  void
35  LoadConfig(const utl::Branch& b, const std::string& tag, T1& var, const T2& defaultValue)
36  {
37  utl::Branch c = b.GetChild(tag);
38  if (c)
39  c.GetData(var);
40  else
41  var = defaultValue;
42  }
43 
44 }
45 
46 
47 #endif
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
Class representing a document branch.
Definition: Branch.h:107
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
void LoadConfig(const utl::Branch &b, const std::string &tag, T1 &var, const T2 &defaultValue)
Helper method to load a particular configuration parameter.
Definition: ConfigUtils.h:35

, generated on Tue Sep 26 2023.