CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 BgetBuilder (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

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

Definition at line 27 of file ComponentFactoryByName.h.

Member Function Documentation

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

Definition at line 13 of file ComponentFactoryByName.h.

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

14  {
15  if (myMap().size() == 0)
16  throw SimG4Exception("No Builder registered to the Factory.");
17  if (myMap().find(name) == myMap().end())
18  throw SimG4Exception("The Component "+name+" is not registered to the Factory.");
19  return (myMap()[name]);
20  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
static BuilderMapType & myMap()
#define end
Definition: vmac.h:37
tuple size
Write out results.
template<class B >
static BuilderMapType& ComponentFactoryByName< B >::myMap ( )
inlinestaticprotected

Definition at line 29 of file ComponentFactoryByName.h.

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

30  {
31  static BuilderMapType me_;
32  return me_;
33  }
std::map< std::string, B * > BuilderMapType
template<class B >
static void ComponentFactoryByName< B >::setBuilder ( B in,
const std::string &  name 
)
inlinestatic

Definition at line 21 of file ComponentFactoryByName.h.

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

22  {
23  if (name.empty())
24  throw SimG4Exception("The registration of Components without name is not allowed.");
25  myMap()[name] = in;
26  }
static BuilderMapType & myMap()