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

DynamicPluggableFactory.h

Go to the documentation of this file.
00001 
00002 // $Id: DynamicPluggableFactory.h,v 1.4 2002/07/30 19:35:20 gmieg Exp $
00003 //
00004 // DynamicPluggableFactory.h
00005 //
00006 // DynamicPluggableFactory implements Dynamic Pluggable Factory Pattern.
00007 // Adapted from "Pluggable Factory in Practice" by Anthony Lauder,
00008 // C++ Report, October 1999, p. 27
00009 //
00010 // Author:  G. Irwin 10/2000
00012 
00013 #ifndef DYNAMICPLUGGABLEFACTORY_H
00014 #define DYNAMICPLUGGABLEFACTORY_H
00015 
00016 #include "DynamicFactory/NamedProductPluggableFactory.h"
00017 
00018 class DynAlgReg;
00019 
00020 class DynamicPluggableFactory : public NamedProductPluggableFactory
00021 {
00022 
00023 public:
00024   static DynamicPluggableFactory &GetInstance();
00025 
00026   Bool_t IsRegistered(const char *regnm) const;
00027   virtual AlgBase &LendAlg(const char *algnm);
00028   virtual AlgConfig &LendAlgConfig(const char *regnm);
00029   void Register(DynAlgReg *dar);
00030 
00031 private:
00032   static DynamicPluggableFactory *fsTheInstance;
00033   TList fDynamicAlgRegistry;               // Contains DynAlgReg objects
00034 
00035   DynamicPluggableFactory();
00036   virtual ~DynamicPluggableFactory();
00037   AlgBase *GetPrototypicalAlg(const char *algnm);
00038   AlgConfig *GetPrototypicalAlgConfig(const char *regnm);
00039   AlgBase *LinkPrototypicalAlg(const char *algnm);
00040   AlgConfig *LinkPrototypicalAlgConfig(const char *cclnm);
00041 
00042 // These methods are private and not implemented to prevent copying.
00043   DynamicPluggableFactory(const DynamicPluggableFactory &);
00044   void operator=(const DynamicPluggableFactory &);
00045 
00046 // This section sets up the singleton machinery.
00047 // Cleaner struct used to clean up singleton at end of job
00048    struct Cleaner {
00049      void UseMe() { }                  // Dummy method to quiet compiler
00050     ~Cleaner() {
00051        if (DynamicPluggableFactory::fsTheInstance != 0) {
00052          delete DynamicPluggableFactory::fsTheInstance;
00053          DynamicPluggableFactory::fsTheInstance = 0;
00054    } } };
00055 
00056    friend struct Cleaner; 
00057 
00058 ClassDef(DynamicPluggableFactory,0)     // DynamicPluggableFactory Class
00059 
00060 };
00061 
00062 #endif                                      // DYNAMICPLUGGABLEFACTORY_H

Generated on Mon Feb 15 11:06:38 2010 for loon by  doxygen 1.3.9.1