Back to index

nordugrid-arc-nox  1.1.0~rc6
MCCLoader.h
Go to the documentation of this file.
00001 #ifndef __ARC_MCCLOADER_H__
00002 #define __ARC_MCCLOADER_H__
00003 
00004 #include <string>
00005 #include <map>
00006 #include <arc/ArcConfig.h>
00007 
00008 #include <arc/message/MCC.h>
00009 #include <arc/message/Service.h>
00010 #include <arc/message/Plexer.h>
00011 #include <arc/message/SecHandler.h>
00012 
00013 #include <arc/loader/Plugin.h>
00014 #include <arc/loader/Loader.h>
00015 
00016 namespace Arc {
00017 
00018   // Internal classes - used in private methods
00019   class mcc_connectors_t;
00020   class plexer_connectors_t;
00021 
00022   class ChainContext;
00023 
00025 
00046   class MCCLoader: public Loader {
00047     friend class ChainContext;
00048    public:
00049     typedef std::map<std::string, MCC*>        mcc_container_t;
00050     typedef std::map<std::string, Service*>    service_container_t;
00051     typedef std::map<std::string, ArcSec::SecHandler*> sechandler_container_t;
00052     typedef std::map<std::string, Plexer*>     plexer_container_t;
00053 
00054    private:
00055     bool valid_;
00056 
00058     mcc_container_t mccs_;
00059 
00061     mcc_container_t mccs_exposed_;
00062 
00064     service_container_t services_;
00065 
00067     sechandler_container_t sechandlers_;
00068 
00070     plexer_container_t plexers_;
00071 
00078     bool make_elements(Config& cfg, int level = 0,
00079                      mcc_connectors_t *mcc_connectors = NULL,
00080                      plexer_connectors_t *plexer_connectors = NULL);
00081 
00082     ChainContext* context_;
00083 
00084    public:
00085     MCCLoader():valid_(false) {};
00088     MCCLoader(Config& cfg);
00090     ~MCCLoader();
00094     MCC* operator[](const std::string& id);
00095     MCC* operator[](const char* id) { return operator[](std::string(id)); };
00096 
00097     operator bool(void) { return valid_; };
00098     bool operator!(void) { return !valid_; };
00099  };
00100 
00102 
00106   class ChainContext {
00107     friend class MCCLoader;
00108    private:
00109     MCCLoader& loader_;
00110     ChainContext(MCCLoader& loader) : loader_(loader) {};
00111     ~ChainContext() {};
00112    public:
00114     operator PluginsFactory*()    { return loader_.factory_; };
00115   };
00116 
00117 } // namespace Arc
00118 
00119 #endif /* __ARC_MCCLOADER_H__ */