00001 #ifndef SCT_CONFIGURAITON_REGISTRY_H 00002 #define SCT_CONFIGURAITON_REGISTRY_H 00003 00004 #include <map> 00005 #include <string> 00006 00007 #include "configuration.h" 00008 00009 namespace SctConfiguration { 00011 class Factory { 00012 public: 00014 virtual Configuration *defaultConfig() = 0; 00016 virtual Configuration *fromFile(std::string fileName) = 0; 00017 }; 00018 00019 class FactoryManager { 00020 public: 00022 Factory &getFactory(std::string backend); 00024 bool addFactory(std::string backend, Factory &factory); 00026 static FactoryManager& instance(); 00027 00028 void listFactories(); 00029 00031 bool loadPlugin(std::string name); 00032 private: 00033 std::map<std::string, Factory *> configurationRegistry; 00034 FactoryManager() throw() {} 00035 static FactoryManager* singleton; 00036 }; 00037 00038 } 00039 00040 #endif