CMS 3D CMS Logo

List of all members | Public Types | Static Public Member Functions | Static Protected Member Functions
ComponentFactoryByName< B > Class Template Reference

#include <ComponentFactoryByName.h>

Public Types

typedef std::map< std::string, B * > BuilderMapType
 

Static Public Member Functions

static B * getBuilder (const std::string &name)
 
static void setBuilder (B *in, const std::string &name)
 

Static Protected Member Functions

static BuilderMapTypemyMap ()
 

Detailed Description

template<class B>
class ComponentFactoryByName< B >

Definition at line 10 of file ComponentFactoryByName.h.

Member Typedef Documentation

◆ BuilderMapType

template<class B >
typedef std::map<std::string,B *> ComponentFactoryByName< B >::BuilderMapType

Definition at line 30 of file ComponentFactoryByName.h.

Member Function Documentation

◆ getBuilder()

template<class B >
static B* ComponentFactoryByName< B >::getBuilder ( const std::string &  name)
inlinestatic

Definition at line 13 of file ComponentFactoryByName.h.

14  {
15  if (myMap().size() == 0) {
16  throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::getBuilder: No Builder registered to the Factory.");
17  }
18  if (myMap().find(name) == myMap().end()) {
19  throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::getBuilder: The Component "+name+" is not registered to the Factory.");
20  }
21  return (myMap()[name]);
22  }

References mps_fire::end, Exception, spr::find(), ComponentFactoryByName< B >::myMap(), Skims_PA_cff::name, and findQualityFiles::size.

◆ myMap()

template<class B >
static BuilderMapType& ComponentFactoryByName< B >::myMap ( )
inlinestaticprotected

Definition at line 32 of file ComponentFactoryByName.h.

33  {
34  static BuilderMapType me_;
35  return me_;
36  }

Referenced by ComponentFactoryByName< B >::getBuilder(), and ComponentFactoryByName< B >::setBuilder().

◆ setBuilder()

template<class B >
static void ComponentFactoryByName< B >::setBuilder ( B *  in,
const std::string &  name 
)
inlinestatic

Definition at line 23 of file ComponentFactoryByName.h.

24  {
25  if (name.empty()) {
26  throw cms::Exception("SimG4CoreNotification", " ComponentFactoryByName::setBuilder: The registration of Components without name is not allowed.");
27  }
28  myMap()[name] = in;
29  }

References Exception, recoMuon::in, ComponentFactoryByName< B >::myMap(), and Skims_PA_cff::name.

spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ComponentFactoryByName::myMap
static BuilderMapType & myMap()
Definition: ComponentFactoryByName.h:32
mps_fire.end
end
Definition: mps_fire.py:242
recoMuon::in
Definition: RecoMuonEnumerators.h:6
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
ComponentFactoryByName::BuilderMapType
std::map< std::string, B * > BuilderMapType
Definition: ComponentFactoryByName.h:30
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443