CMS 3D CMS Logo

VertexRecoManager.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 
6  const string & name, std::function<AbstractConfReconstructor*()> o, const string & d )
7 {
8  theAbstractConfReconstructors[name]=o;
9  theDescription[name]=d;
10 }
11 
13 {
14 }
15 
17 {
18  auto found = theDescription.find(d);
19  if(found == theDescription.end()) {
20  return std::string();
21  }
22  return found->second;
23 }
24 
26 {
27  return new VertexRecoManager ( * this );
28 }
29 
31 {
32  std::cout << "[VertexRecoManager] copy constructor! Error!" << std::endl;
33  exit(0);
34  /*
35  for ( map < string, AbstractConfReconstructor * >::const_iterator i=o.theAbstractConfReconstructors.begin();
36  i!=o.theAbstractConfReconstructors.end() ; ++i )
37  {
38  theAbstractConfReconstructors[ i->first ] = i->second->clone();
39  }
40 
41  theIsEnabled=o.theIsEnabled;
42  */
43 }
44 
46 {
47  //The singleton's internal structure only changes while
48  // this library is being loaded. All other methods are const.
49  [[cms::thread_safe]] static VertexRecoManager singleton;
50  return singleton;
51 }
52 
53 std::unique_ptr<AbstractConfReconstructor> VertexRecoManager::get ( const string & s ) const
54 {
55  auto found = theAbstractConfReconstructors.find(s);
56  if( found == theAbstractConfReconstructors.end()) {
57  return std::unique_ptr<AbstractConfReconstructor>{};
58  }
59  return std::unique_ptr<AbstractConfReconstructor>{found->second()};
60 }
61 
62 std::vector<std::string> VertexRecoManager::getNames() const
63 {
64  std::vector<std::string> ret;
65  ret.reserve(theAbstractConfReconstructors.size());
66  for(const auto& i : theAbstractConfReconstructors ) {
67  ret.push_back(i.first);
68  }
69  return ret;
70 }
71 
73 {}
int i
Definition: DBlmapReader.cc:9
std::string describe(const std::string &) const
std::unique_ptr< AbstractConfReconstructor > get(const std::string &) const
static VertexRecoManager & Instance()
std::vector< std::string > getNames() const
VertexRecoManager * clone() const
void registerReconstructor(const std::string &name, std::function< AbstractConfReconstructor *()> o, const std::string &description)