00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef ABSTRACT_SERVICE_LOCATOR_FACTORY_H_ 00004 #define ABSTRACT_SERVICE_LOCATOR_FACTORY_H_ 00005 00006 #include <fesa-core/Utilities/Mutex.h> 00007 00008 #include <string> 00009 #include <map> 00010 00011 namespace fesa 00012 { 00013 00014 class AbstractServiceLocator; 00015 00020 class AbstractServiceLocatorFactory 00021 { 00022 public: 00023 enum DEPLOYMENT_MODE_TYPE {REALTIME_SPLIT, SERVER_SPLIT, UNSPLIT}; 00024 static AbstractServiceLocatorFactory* getInstance(); 00025 const AbstractServiceLocator* getServiceLocator(const std::string& className); 00026 virtual ~AbstractServiceLocatorFactory(); 00027 AbstractServiceLocatorFactory(); 00028 00029 protected: 00030 virtual AbstractServiceLocator* buildServiceLocator(const std::string& className, DEPLOYMENT_MODE_TYPE type) = 0; 00031 Mutex mutex_; 00032 std::map<std::string, AbstractServiceLocator*> mapAbstractServiceLocator_; // map <className, ServiceLocator> 00033 static AbstractServiceLocatorFactory* theInstance_; 00034 }; 00035 00036 } // fesa 00037 00038 #endif // ABSTRACT_SERVICE_LOCATOR_FACTORY_H_