00001 00002 // $Id: NamedProductPluggableFactory.cxx,v 1.5 2002/06/13 15:43:33 rhatcher Exp $ 00003 // 00004 // NamedProductPluggableFactory.cxx 00005 // 00006 // Begin_Html<img src="../../pedestrians.gif" align=center> 00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 00008 // 00009 // NamedProductPluggableFactory implements Named Product Pluggable 00010 // Factory Pattern. 00011 // Adapted from "Pluggable Factory in Practice" by Anthony Lauder, 00012 // C++ Report, October 1999, p. 27 00013 // 00014 // Author: G. Irwin 10/2000 00015 // 00016 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 00017 // <a href="../DynamicFactory.html"> DynamicFactory Classes</a> (part of 00018 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html 00020 00021 #include <cassert> 00022 00023 #include "Algorithm/AlgBase.h" 00024 #include "Algorithm/AlgConfig.h" 00025 #include "DynamicFactory/NamedProductPluggableFactory.h" 00026 #include "MessageService/MsgService.h" 00027 00028 ClassImp(NamedProductPluggableFactory) 00029 00030 //...................................................................... 00031 CVSID("$Id: NamedProductPluggableFactory.cxx,v 1.5 2002/06/13 15:43:33 rhatcher Exp $"); 00032 00033 //______________________________________________________________________ 00034 NamedProductPluggableFactory::NamedProductPluggableFactory() 00035 { 00036 MSG("DynFac", Msg::kDebug) 00037 << "NamedProductPluggableFactory::Constructor\n"; 00038 } 00039 00040 //______________________________________________________________________ 00041 NamedProductPluggableFactory::~NamedProductPluggableFactory() 00042 { 00043 MSG("DynFac", Msg::kDebug) 00044 << "NamedProductPluggableFactory::Destructor\n"; 00045 00046 fPrototypicalAlgConfigs.Delete(); 00047 fPrototypicalAlgs.Delete(); 00048 } 00049 00050 //______________________________________________________________________ 00051 AlgConfig *NamedProductPluggableFactory::GetAlgConfigPtr( 00052 const char *regnm) 00053 { 00054 TObject *genconf = fPrototypicalAlgConfigs.FindObject(regnm); 00055 return (genconf ? (AlgConfig *) genconf : 0); 00056 } 00057 00058 //______________________________________________________________________ 00059 AlgBase *NamedProductPluggableFactory::GetAlgPtr(const char *algnm) 00060 { 00061 TObject *genalg = fPrototypicalAlgs.FindObject(algnm); 00062 return (genalg ? (AlgBase *) genalg : 0); 00063 } 00064 00065 //______________________________________________________________________ 00066 AlgBase &NamedProductPluggableFactory::LendAlg(const char *algnm) 00067 { 00068 AlgBase *algbase = GetAlgPtr(algnm); 00069 assert(algbase); 00070 return *algbase; 00071 } 00072 00073 //______________________________________________________________________ 00074 AlgConfig &NamedProductPluggableFactory::LendAlgConfig( 00075 const char *regnm) 00076 { 00077 AlgConfig *algconfig = GetAlgConfigPtr(regnm); 00078 assert(algconfig); 00079 return *algconfig; 00080 } 00081 00082 //______________________________________________________________________ 00083 void NamedProductPluggableFactory::RegisterPrototypicalAlg( 00084 AlgBase *prototypicalalg) 00085 { 00086 assert(prototypicalalg); 00087 00088 MSG("DynFac", Msg::kDebug) 00089 << "NamedProductPluggableFactory::RegisterPrototypicalAlg(" 00090 << prototypicalalg->GetName() << ")\n"; 00091 00092 fPrototypicalAlgs.Add(prototypicalalg); 00093 } 00094 00095 //______________________________________________________________________ 00096 void NamedProductPluggableFactory::RegisterPrototypicalAlgConfig( 00097 AlgConfig *prototypicalalgconfig) 00098 { 00099 assert(prototypicalalgconfig); 00100 00101 MSG("DynFac", Msg::kDebug) 00102 << "NamedProductPluggableFactory::RegisterPrototypicalAlgConfig(" 00103 << prototypicalalgconfig->GetName() << ")\n"; 00104 00105 fPrototypicalAlgConfigs.Add(prototypicalalgconfig); 00106 }
1.3.9.1