00001 00016 #ifndef _LI_FINDER_FACTORY_H_ 00017 #define _LI_FINDER_FACTORY_H_ 00018 00019 #include <map> 00020 #include <string> 00021 #include "TObject.h" 00022 00023 class LIPatternFinder; 00024 00025 using std::map; 00026 using std::string; 00027 00028 class LIFinderFactory : public TObject 00029 { 00030 public: 00031 00032 static LIFinderFactory * GetInstance(); 00033 00034 LIPatternFinder * LIFinder(const char * alg_name); 00035 00036 private: 00037 00038 LIFinderFactory(); 00039 LIFinderFactory(const LIFinderFactory & factory); 00040 virtual ~LIFinderFactory(); 00041 00042 static LIFinderFactory * fSelf; 00043 00044 // data & methods for using a concrete algorithm 'cache' 00045 00046 map<string, LIPatternFinder *> fAvailableAlgorithms; 00047 00048 bool AlgorithmExists (const char * alg_name) const; 00049 void AddAlgorithm (const char * alg_name, LIPatternFinder * alg); 00050 00051 LIPatternFinder * GetAlgorithm (const char * alg_name) const; 00052 00053 // singleton cleaner - recommended by George I. 00054 00055 struct Cleaner { 00056 void DummyMethodAndSilentCompiler() { } 00057 ~Cleaner() { 00058 if (LIFinderFactory::fSelf !=0) { 00059 delete LIFinderFactory::fSelf; 00060 LIFinderFactory::fSelf = 0; 00061 } 00062 } 00063 }; 00064 friend struct Cleaner; 00065 00066 ClassDef(LIFinderFactory, 0) // concrete LIPatternFinder object factory 00067 }; 00068 00069 #endif // _LI_FINDER_FACTORY_H_ 00070
1.3.9.1