#include <LIFinderFactory.h>
Public Member Functions | |
| LIPatternFinder * | LIFinder (const char *alg_name) |
Static Public Member Functions | |
| static LIFinderFactory * | GetInstance () |
Private Member Functions | |
| LIFinderFactory () | |
| LIFinderFactory (const LIFinderFactory &factory) | |
| virtual | ~LIFinderFactory () |
| bool | AlgorithmExists (const char *alg_name) const |
| void | AddAlgorithm (const char *alg_name, LIPatternFinder *alg) |
| LIPatternFinder * | GetAlgorithm (const char *alg_name) const |
Private Attributes | |
| map< string, LIPatternFinder * > | fAvailableAlgorithms |
Static Private Attributes | |
| static LIFinderFactory * | fSelf = 0 |
Friends | |
| struct | Cleaner |
Classes | |
| struct | Cleaner |
Definition at line 28 of file LIFinderFactory.h.
| LIFinderFactory::LIFinderFactory | ( | ) | [private] |
Definition at line 46 of file LIFinderFactory.cxx.
References fSelf.
00047 { 00048 fSelf = 0; 00049 }
| LIFinderFactory::LIFinderFactory | ( | const LIFinderFactory & | factory | ) | [private] |
| LIFinderFactory::~LIFinderFactory | ( | ) | [private, virtual] |
Definition at line 51 of file LIFinderFactory.cxx.
References fAvailableAlgorithms, and fSelf.
00052 { 00053 fSelf = 0; 00054 00055 fAvailableAlgorithms.clear(); 00056 }
| void LIFinderFactory::AddAlgorithm | ( | const char * | alg_name, | |
| LIPatternFinder * | alg | |||
| ) | [private] |
Definition at line 104 of file LIFinderFactory.cxx.
References fAvailableAlgorithms.
Referenced by LIFinder().
00106 { 00107 fAvailableAlgorithms.insert( 00108 map<string, LIPatternFinder *>::value_type( 00109 string(alg_name), alg) ); 00110 }
| bool LIFinderFactory::AlgorithmExists | ( | const char * | alg_name | ) | const [private] |
Definition at line 99 of file LIFinderFactory.cxx.
References fAvailableAlgorithms.
Referenced by LIFinder().
00100 { 00101 return (fAvailableAlgorithms.count(string(alg_name)) == 1); 00102 }
| LIPatternFinder * LIFinderFactory::GetAlgorithm | ( | const char * | alg_name | ) | const [private] |
Definition at line 112 of file LIFinderFactory.cxx.
References fAvailableAlgorithms.
Referenced by LIFinder().
00114 { 00115 map<string, LIPatternFinder *>::const_iterator alg_iter; 00116 00117 alg_iter = fAvailableAlgorithms.find(string(alg_name)); 00118 00119 return alg_iter->second; 00120 }
| LIFinderFactory * LIFinderFactory::GetInstance | ( | ) | [static] |
Definition at line 30 of file LIFinderFactory.cxx.
References LIFinderFactory::Cleaner::DummyMethodAndSilentCompiler(), Msg::kVerbose, and MSG.
Referenced by FilterLIModule::Ana().
00031 { 00032 MSG("LIFilter", Msg::kVerbose) << "LIFinderFactory::Instance" << endl; 00033 00034 if(fSelf == 0) { 00035 00036 static LIFinderFactory::Cleaner cleaner; 00037 00038 cleaner.DummyMethodAndSilentCompiler(); 00039 00040 fSelf = new LIFinderFactory; 00041 } 00042 00043 return fSelf; 00044 }
| LIPatternFinder * LIFinderFactory::LIFinder | ( | const char * | alg_name | ) |
Definition at line 58 of file LIFinderFactory.cxx.
References AddAlgorithm(), AlgorithmExists(), GetAlgorithm(), Msg::kVerbose, and MSG.
Referenced by FilterLIModule::Ana().
00059 { 00060 MSG("LIFilter", Msg::kVerbose) 00061 << "LIFinderFactory: [" << algname 00062 << "] algorithm requested " << endl; 00063 00064 if( strcmp(algname,"SimplePatternFinder") == 0 ) { 00065 00066 //--- retrieve or instantiate a LIPatternFinderSimple object 00067 00068 MSG("LIFilter", Msg::kVerbose) 00069 << "SimplePatternFinder selected" << endl; 00070 00071 //return new LIPatternFinderSimple; 00072 00073 if( AlgorithmExists("SimplePatternFinder") ) 00074 return GetAlgorithm("SimplePatternFinder"); 00075 else { 00076 LIPatternFinder * pattern_finder = new LIPatternFinderSimple; 00077 AddAlgorithm("SimplePatternFinder", pattern_finder); 00078 return GetAlgorithm("SimplePatternFinder"); 00079 } 00080 00081 } else if ( strcmp(algname,"FancyPatternFinder") == 0 ) { 00082 00083 //--- retrieve or instantiate a LIPatternFinderFancy object 00084 00085 MSG("LIFilter", Msg::kVerbose) 00086 << "FancyPatternFinder selected" << endl; 00087 00088 if( AlgorithmExists("FancyPatternFinder") ) 00089 return GetAlgorithm("FancyPatternFinder"); 00090 else { 00091 LIPatternFinder * pattern_finder = new LIPatternFinderFancy; 00092 AddAlgorithm("FancyPatternFinder", pattern_finder); 00093 return GetAlgorithm("FancyPatternFinder"); 00094 } 00095 00096 } else return 0; 00097 }
friend struct Cleaner [friend] |
Definition at line 64 of file LIFinderFactory.h.
map<string, LIPatternFinder *> LIFinderFactory::fAvailableAlgorithms [private] |
Definition at line 46 of file LIFinderFactory.h.
Referenced by AddAlgorithm(), AlgorithmExists(), GetAlgorithm(), and ~LIFinderFactory().
LIFinderFactory * LIFinderFactory::fSelf = 0 [static, private] |
Definition at line 42 of file LIFinderFactory.h.
Referenced by LIFinderFactory(), LIFinderFactory::Cleaner::~Cleaner(), and ~LIFinderFactory().
1.4.7