Back to index

nordugrid-arc-nox  1.1.0~rc6
ClassLoader.h
Go to the documentation of this file.
00001 #ifndef __ARC_CLASSLOADER_H__
00002 #define __ARC_CLASSLOADER_H__
00003 
00004 #include <map>
00005 #include <string>
00006 
00007 #include <arc/ArcConfig.h>
00008 #include <arc/Logger.h>
00009 #include <arc/loader/Plugin.h>
00010 
00016 namespace Arc{
00017 
00018 typedef Plugin LoadableClass;
00019 
00020 // TODO: Unify  with Loader
00021 class ClassLoader : public PluginsFactory {
00022   protected:
00023     ClassLoader(Config *cfg = NULL);
00024   protected:
00025     void load_all_instances(Config *cfg);    
00026 
00027   public:
00028     static ClassLoader* getClassLoader(Config* cfg = NULL); 
00029 
00030     LoadableClass *Instance(const std::string& classId, XMLNode* arg = NULL, const std::string& className = "");
00031     LoadableClass *Instance(XMLNode* arg = NULL, const std::string& className = "");
00032 
00033     ~ClassLoader();
00034   
00035   private:
00036     static Logger logger;
00037     static ClassLoader* _instance;
00038 };
00039 
00040 class ClassLoaderPluginArgument: public PluginArgument {
00041   private:
00042     XMLNode* xml_;
00043   public:
00044     ClassLoaderPluginArgument(XMLNode* xml):xml_(xml) { };
00045     virtual ~ClassLoaderPluginArgument(void) { };
00046     operator XMLNode* (void) { return xml_; };
00047 };
00048 
00049 } // namespace Arc
00050 
00051 #endif /* __ARC_CLASSLOADER_H__ */