Hammer  1.0.0
Helicity Amplitude Module for Matrix Element Reweighting
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SettingDefs.hh
Go to the documentation of this file.
1 #pragma clang diagnostic push
2 #pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
3 ///
4 /// @file SettingDefs.hh
5 /// @brief Settings class template methods definitions
6 ///
7 #pragma clang diagnostic pop
8 
9 //**** This file is a part of the HAMMER library
10 //**** Copyright (C) 2016 - 2020 The HAMMER Collaboration
11 //**** HAMMER is licensed under version 3 of the GPL; see COPYING for details
12 //**** Please note the MCnet academic guidelines; see GUIDELINES for details
13 
14 // -*- C++ -*-
15 
16 namespace Hammer {
17 
18  template <typename T>
20  return boost::get<T>(&_value);
21  }
22 
23  template <typename T>
24  const T* Setting::getValue() const {
25  return boost::get<const T>(&_value);
26  }
27 
28  template <typename T>
29  void Setting::setValue(const T& value) {
30  if(_value.which() != 0 && _value.type() != typeid(T)) {
31  throw InitializationError("Invalid type in setting!");
32  }
33  _value = value;
34  }
35 
36  template <typename T>
38  return boost::get<T>(&_default);
39  }
40 
41  template <typename T>
42  const T* Setting::getDefault() const {
43  return boost::get<const T>(&_default);
44  }
45 
46  template <typename T>
47  void Setting::setDefault(const T& value) {
48  if(_default.which() != 0 && _default.type() != typeid(T)) {
49  throw InitializationError("Invalid type in setting!");
50  }
51  _default = value;
52  }
53 
54 } // namespace Hammer
T * getDefault()
get the default value of this setting
Definition: SettingDefs.hh:37
T * getValue()
access the setting value
Definition: SettingDefs.hh:19
void setValue(const T &value)
modify the setting value
Definition: SettingDefs.hh:29
SettingType _default
setting default value
Definition: Setting.hh:126
Initialization error class.
Definition: Exceptions.hh:69
void setDefault()
Definition: Setting.cc:304
SettingType _value
setting value
Definition: Setting.hh:124