Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

StopMuFinderFactory Class Reference

StopMuFinderFactory - creates StopMuFinder objects. More...

#include <StopMuFinderFactory.h>

List of all members.

Public Types

typedef StopMuFinder *(* SMFCreator )()
 pointer to function creating histogram block

Public Member Functions

bool RegisterStopMuFinder (std::string StopMuFinderId, SMFCreator creator)
 Returns 'true' if registration was successful.
bool UnregisterStopMuFinder (std::string StopMuFinderId)
 Returns 'true' if the StopMuFinderId was registered before.
StopMuFinderCreateStopMuFinder (std::string StopMuFinderId)
 create StopMuFinder given its name
StopMuFinderCreateStopMuFinder (const VldContext &vldc)
 create StopMuFinder given validity context

Static Public Member Functions

StopMuFinderFactoryInstance ()
 get reference to the SMFFactory singleton

Private Types

typedef std::map< std::string,
SMFCreator
CallbackMap
 map of creator function pointers keyed by name

Private Member Functions

 StopMuFinderFactory ()
 SMFFactory is a singleton - ctor/copy-ctor are private.
 StopMuFinderFactory (const StopMuFinderFactory &)

Private Attributes

CallbackMap fCallbacks

Static Private Attributes

StopMuFinderFactoryfInstance = 0
 initialize singleton


Detailed Description

StopMuFinderFactory - creates StopMuFinder objects.

Author:
Sergei avva@fnal.gov 2005-03
Id
StopMuFinderFactory.cxx,v 1.3 2007/11/11 07:29:53 rhatcher Exp

Definition at line 17 of file StopMuFinderFactory.h.


Member Typedef Documentation

typedef std::map<std::string, SMFCreator> StopMuFinderFactory::CallbackMap [private]
 

map of creator function pointers keyed by name

Definition at line 25 of file StopMuFinderFactory.h.

typedef StopMuFinder*(* StopMuFinderFactory::SMFCreator)()
 

pointer to function creating histogram block

Definition at line 21 of file StopMuFinderFactory.h.


Constructor & Destructor Documentation

StopMuFinderFactory::StopMuFinderFactory  )  [private]
 

SMFFactory is a singleton - ctor/copy-ctor are private.

Definition at line 114 of file StopMuFinderFactory.cxx.

00114 {}

StopMuFinderFactory::StopMuFinderFactory const StopMuFinderFactory  )  [private]
 

Definition at line 115 of file StopMuFinderFactory.cxx.

00115 {}


Member Function Documentation

StopMuFinder * StopMuFinderFactory::CreateStopMuFinder const VldContext vldc  ) 
 

create StopMuFinder given validity context

CreateStopMuFinder - calls stop mu finder creator given validity context

Definition at line 91 of file StopMuFinderFactory.cxx.

References CreateStopMuFinder(), VldContext::GetDetector(), and MSG.

00092 {
00093     MSG("StopMuFilter",Msg::kDebug) 
00094         << "StopMuFinderFactory::CreatStopMuFinder(VldContext)" 
00095         << endl;
00096         
00097     string smfname;
00098     if ( vldc.GetDetector() == Detector::kFar ) {
00099         smfname = string("StopMuFinderFar");
00100         StopMuFinder* smf = CreateStopMuFinder(smfname);
00101         return smf;        
00102     } else {   
00103         MSG("StopMuFilter",Msg::kError) 
00104             << "Can not create StopMuFinder for " 
00105             << vldc.GetDetector() << " detctor." << endl;
00106         return 0;
00107     }
00108         
00109 } // StopMuFinder* StopMuFinderFactory::CreateStopMuFinder(string)

StopMuFinder * StopMuFinderFactory::CreateStopMuFinder std::string  StopMuFinderId  ) 
 

create StopMuFinder given its name

CreateStopMuFinder - calls stop mu finder creator given its name

Definition at line 68 of file StopMuFinderFactory.cxx.

References fCallbacks, and MSG.

Referenced by CreateStopMuFinder().

00069 {
00070     MSG("StopMuFilter",Msg::kDebug) 
00071         << "StopMuFinderFactory::CreateStopMuFinder(string)" 
00072         << endl;
00073         
00074     CallbackMap::const_iterator i = fCallbacks.find(smfname); 
00075     
00076     // handle unknown histogram block request
00077     if (i == fCallbacks.end()) {
00078         MSG("StopMuFilter",Msg::kError) 
00079             << "Dont know anything about " << smfname << endl;
00080         return 0;
00081     }
00082     
00083     // Invoke creator function 
00084     return (i->second)();
00085 } // StopMuFinder* StopMuFinderFactory::CreateStopMuFinder(string)

StopMuFinderFactory & StopMuFinderFactory::Instance  )  [static]
 

get reference to the SMFFactory singleton

Get SMFFactory reference

Definition at line 26 of file StopMuFinderFactory.cxx.

References fInstance, and MSG.

Referenced by StopMuFilterModule::Ana().

00027 {
00028     MSG("StopMuFilter",Msg::kDebug) 
00029         << "StopMuFinderFactory::Instance()" << endl;
00030     
00031     if ( !fInstance ) fInstance = new StopMuFinderFactory;
00032     return *fInstance;
00033 } // StopMuFinderFactory& StopMuFinderFactory::Instance()

bool StopMuFinderFactory::RegisterStopMuFinder std::string  StopMuFinderId,
SMFCreator  creator
 

Returns 'true' if registration was successful.

Register histogram block creator function

Definition at line 39 of file StopMuFinderFactory.cxx.

References fCallbacks, and MSG.

00042 { 
00043     MSG("StopMuFilter",Msg::kDebug) 
00044         << "StopMuFinderFactory::RegisterStopMuFinder(string, SMFCreator)" 
00045         << endl;
00046         
00047     // map<>::insert(value_type) returns pair<iterator, bool>  
00048     return fCallbacks.insert(CallbackMap::value_type(smfname, creator)).second; 
00049 } // bool StopMuFinderFactory::RegisterStopMuFinder(string, SMFCreator)

bool StopMuFinderFactory::UnregisterStopMuFinder std::string  StopMuFinderId  ) 
 

Returns 'true' if the StopMuFinderId was registered before.

Unregister histogram block

Definition at line 55 of file StopMuFinderFactory.cxx.

References fCallbacks, and MSG.

00056 { 
00057     MSG("StopMuFilter",Msg::kDebug) 
00058         << "StopMuFinderFactory::UnregisterStopMuFinder(string)" 
00059         << endl;
00060         
00061     return fCallbacks.erase(smfname) == 1; 
00062 } // bool StopMuFinderFactory::UnregisterStopMuFinder(string)


Member Data Documentation

CallbackMap StopMuFinderFactory::fCallbacks [private]
 

Definition at line 50 of file StopMuFinderFactory.h.

Referenced by CreateStopMuFinder(), RegisterStopMuFinder(), and UnregisterStopMuFinder().

StopMuFinderFactory * StopMuFinderFactory::fInstance = 0 [static, private]
 

initialize singleton

Definition at line 21 of file StopMuFinderFactory.cxx.

Referenced by Instance().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:20 2010 for loon by  doxygen 1.3.9.1