LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
WeightCalcFactory.cxx
Go to the documentation of this file.
1 #include "WeightCalcFactory.h"
2 #include "WeightCalcCreator.h"
3 
4 namespace evwgh {
5 
6  WeightCalc* WeightCalcFactory::Create(const std::string& wghcalcname)
7  {
9  i = GetTable().find(wghcalcname);
10 
11  if (i != GetTable().end())
12  return i->second->Create();
13  else
14  return (WeightCalc*)NULL;
15  }
16 
17  void WeightCalcFactory::Register(const std::string& wghcalcname, WeightCalcCreator* creator)
18  {
19  GetTable()[wghcalcname] = creator;
20  }
21 
22  std::map<std::string, WeightCalcCreator*>& WeightCalcFactory::GetTable()
23  {
24  static std::map<std::string, WeightCalcCreator*> table;
25  return table;
26  }
27 
28 }
intermediate_table::iterator iterator
static WeightCalc * Create(const std::string &classname)
static std::map< std::string, WeightCalcCreator * > & GetTable()
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
static void Register(const std::string &wghcalcname, WeightCalcCreator *creator)