PhotonTransportMaker Class Reference

#include <PhotonTransportMaker.h>

Inheritance diagram for PhotonTransportMaker:
PhotonTransportMakerProxy< T >

List of all members.

Static Public Member Functions

static PhotonTransportModuleCreate (std::string className)
static Bool_t HasRegisteredClass (std::string className)

Protected Types

typedef std::map< std::string,
PhotonTransportMaker * > 
MakerMap_t

Protected Member Functions

 PhotonTransportMaker (const char *className)
virtual ~PhotonTransportMaker ()
virtual PhotonTransportModuleCreate () const =0
 ClassDef (PhotonTransportMaker, 0)

Static Protected Member Functions

static MakerMap_tGetMakerMap ()

Detailed Description

Definition at line 13 of file PhotonTransportMaker.h.


Member Typedef Documentation

typedef std::map<std::string,PhotonTransportMaker*> PhotonTransportMaker::MakerMap_t [protected]

Definition at line 24 of file PhotonTransportMaker.h.


Constructor & Destructor Documentation

PhotonTransportMaker::PhotonTransportMaker ( const char *  className  )  [protected]

Definition at line 41 of file PhotonTransportMaker.cxx.

References GetMakerMap().

00042 {
00043   std::string tmp(className);
00044   //std::cout << "Adding Maker: " << tmp << std::endl;
00045   GetMakerMap().insert(std::pair<std::string,PhotonTransportMaker*>(tmp,this));
00046 }

virtual PhotonTransportMaker::~PhotonTransportMaker (  )  [inline, protected, virtual]

Definition at line 20 of file PhotonTransportMaker.h.

00020 { }


Member Function Documentation

PhotonTransportMaker::ClassDef ( PhotonTransportMaker  ,
 
) [protected]
virtual PhotonTransportModule* PhotonTransportMaker::Create (  )  const [protected, pure virtual]
PhotonTransportModule * PhotonTransportMaker::Create ( std::string  className  )  [static]

Definition at line 8 of file PhotonTransportMaker.cxx.

References it.

00009 {
00010   // Find the concrete factory:
00011   MakerMap_t::iterator it = GetMakerMap().find(className);
00012  
00013   if(it == GetMakerMap().end()) {
00014     // If it doesn't exist, return null.
00015     return 0;
00016   } else {
00017     // Otherwise, get the concrete factory to make one.
00018     PhotonTransportModule* obj = it->second->Create();
00019     return obj;
00020   }
00021 
00022   // Make compiler happy:
00023   return 0;
00024 }

PhotonTransportMaker::MakerMap_t & PhotonTransportMaker::GetMakerMap (  )  [static, protected]

Definition at line 49 of file PhotonTransportMaker.cxx.

Referenced by HasRegisteredClass(), and PhotonTransportMaker().

00050 {
00051   // The whole point to this little function is to hide the 
00052   // static map from the compiler, to avoid
00053   // the "static initialization order fiasco"
00054   // ref: http://www.parashift.com/c++-faq-lite/ctors.html section 10.12
00055   
00056   // This object gets created on the first call,
00057   // thus ensuring it exists whenever it's needed. (i.e. before main())
00058   static MakerMap_t theMap;
00059   return theMap;
00060 }

Bool_t PhotonTransportMaker::HasRegisteredClass ( std::string  className  )  [static]

Definition at line 27 of file PhotonTransportMaker.cxx.

References GetMakerMap(), and it.

00028 {
00029   // Find the concrete factory:
00030   MakerMap_t::iterator it = GetMakerMap().find(className);
00031   
00032   if(it == GetMakerMap().end()) {
00033     // If it doesn't exist, return null.
00034     return false;
00035   };
00036   return true;
00037 }


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1