Belle II Software  release-08-01-10
FilterParamMap.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #include <tracking/trackFindingCDC/filters/base/FilterParamMap.h>
9 
10 #include <tracking/trackFindingCDC/utilities/ParameterVariant.h>
11 
12 #include <framework/core/ModuleParamList.templateDetails.h>
13 #include <framework/core/ModuleParam.templateDetails.h>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
18 namespace Belle2 {
23  namespace TrackFindingCDC {
24  using FilterParamVariant = boost::variant<bool, int, double, std::string, std::vector<std::string> >;
25  }
27 }
28 
29 // Instantiate the module parameter
31 
32 namespace Belle2 {
37  namespace TrackFindingCDC {
38 
41  public:
42  Impl() = default;
43 
45  void addParameter(ModuleParamList* moduleParamList, const std::string& name, const std::string& description)
46  {
47  moduleParamList->addParameter(name,
48  m_param_filterParameters,
49  description,
50  m_param_filterParameters);
51  }
52 
54  void assignTo(ModuleParamList* filterModuleParamList)
55  {
56  AssignParameterVisitor::update(filterModuleParamList, m_param_filterParameters);
57  }
58 
60  std::map<std::string, FilterParamVariant> getValues() const
61  {
62  return m_param_filterParameters;
63  }
64 
65  private:
67  std::map<std::string, FilterParamVariant> m_param_filterParameters;
68  };
69  }
71 }
72 
74  m_impl(std::make_unique<Impl>())
75 {
76 }
77 
79 
80 void
81 FilterParamMap::addParameter(ModuleParamList* moduleParamList, const std::string& name, const std::string& description)
82 {
83  m_impl->addParameter(moduleParamList, name, description);
84 }
85 
86 void
88 {
89  m_impl->assignTo(filterModuleParamList);
90 };
91 
92 // std::map<std::string, FilterParamVariant> FilterParamMap::getValues() const
93 // {
94 // return m_impl->getValues();
95 // }
The Module parameter list class.
A single parameter of the module.
Definition: ModuleParam.h:34
std::map< std::string, FilterParamVariant > m_param_filterParameters
Parameter values.
void addParameter(ModuleParamList *moduleParamList, const std::string &name, const std::string &description)
Add name, description and values to the module's parameter list.
void assignTo(ModuleParamList *filterModuleParamList)
Assign values to the module-parameters in the module's list.
std::map< std::string, FilterParamVariant > getValues() const
Retrieve the parameter (name,value) pairs.
void addParameter(ModuleParamList *moduleParamList, const std::string &name, const std::string &description)
Create one parameter in the parameter list for the module with the given name and desciption.
std::unique_ptr< Impl > m_impl
Pointer to implementation hiding the details.
void assignTo(ModuleParamList *filterModuleParamList)
Unpack the map of parameters and forward them to the concrete filter.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.
static void update(ModuleParamList *moduleParamList, const std::map< std::string, boost::variant< T... > > &valuesByName)
Transfer all the parameters from the map boost:variant values to the module parmeter list.