00001 00002 // $Id: AlgFactory.h,v 1.14 2003/05/16 01:26:38 gmieg Exp $ 00003 // 00004 // AlgFactory.h 00005 // 00006 // AlgFactory creates Algorithm objects derived from AlgBase. 00007 // 00008 // Author: G. Irwin 2/2000 00010 00011 #ifndef ALGFACTORY_H 00012 #define ALGFACTORY_H 00013 00014 #include "TList.h" 00015 00016 #include "Algorithm/AlgHandle.h" 00017 00018 class AlgBase; 00019 class AlgConfig; 00020 class AlgHandle; 00021 class ConfigRecord; 00022 class VldContext; 00023 00024 class AlgFactory 00025 { 00026 00027 public: 00028 static AlgFactory &GetInstance(); 00029 00030 AlgHandle GetAlgHandle(const char *algnm, const char *cnfnm); 00031 ConfigRecord *GetOwnedConfigRecord(const VldContext *vld); 00032 void Register(const char *algnm, const char *cnfnm, 00033 const char *libnm = 0, const char *cclnm = 0); 00034 00035 private: 00036 static AlgFactory *fsTheInstance; 00037 TList fAlgHandleList; 00038 Bool_t fConfigRecordIsModified; 00039 00040 AlgFactory(); 00041 virtual ~AlgFactory(); 00042 00043 // These methods are private and not implemented to prevent copying. 00044 AlgFactory(const AlgFactory &); 00045 void operator=(const AlgFactory &); 00046 00047 // This section sets up the singleton machinery. 00048 // Cleaner struct used to clean up singleton at end of job 00049 struct Cleaner { 00050 void UseMe() { } // Dummy method to quiet compiler 00051 ~Cleaner() { 00052 if (AlgFactory::fsTheInstance != 0) { 00053 delete AlgFactory::fsTheInstance; 00054 AlgFactory::fsTheInstance = 0; 00055 } } }; 00056 00057 friend struct Cleaner; 00058 00059 ClassDef(AlgFactory,0) // Creates Algorithm objects derived from AlgBase 00060 00061 }; 00062 00063 #endif // ALGFACTORY_H
1.3.9.1