AbstractServiceLocatorFactory.cpp

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #include <fesa-core/Core/AbstractServiceLocatorFactory.h>
00004 
00005 #include <fesa-core/Core/AbstractServiceLocator.h>
00006 #include <fesa-core/Utilities/Lock.h>
00007 #include <fesa-core/Exception/FesaException.h>
00008 
00009 
00010 namespace fesa
00011 {
00012 
00013 AbstractServiceLocatorFactory* AbstractServiceLocatorFactory::theInstance_ = 0;
00014 
00015 AbstractServiceLocatorFactory* AbstractServiceLocatorFactory::getInstance()
00016 {
00017     return theInstance_;
00018 }
00019 
00020 const AbstractServiceLocator* AbstractServiceLocatorFactory::getServiceLocator(const std::string& className)
00021 {
00022     Lock lock(mutex_);
00023     std::map<std::string, AbstractServiceLocator*>::const_iterator itr = mapAbstractServiceLocator_.find(className);
00024     if (itr == mapAbstractServiceLocator_.end())
00025     {
00026         // TODO: Log error as soon as new logger implementation is available
00027         throw FesaException(__FILE__, __LINE__, FesaErrorServiceLocatorWasNotFound.c_str());
00028     }
00029     return itr->second;
00030 }
00031 
00032 AbstractServiceLocatorFactory::~AbstractServiceLocatorFactory()
00033 {
00034 }
00035 
00036 AbstractServiceLocatorFactory::AbstractServiceLocatorFactory()
00037 {
00038 }
00039 
00040 } // fesa

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1