LAMA
|
00001 00036 #ifndef LAMA_COMMUNICATOR_FACTORY_HPP_ 00037 #define LAMA_COMMUNICATOR_FACTORY_HPP_ 00038 00039 // for dll_import 00040 #include <lama/config.hpp> 00041 00042 // base classes 00043 #include <lama/NonCopyable.hpp> 00044 00045 // others 00046 #include <lama/Communicator.hpp> 00047 00048 // logging 00049 #include <logging/logging.hpp> 00050 00051 // boost 00052 #include <boost/shared_ptr.hpp> 00053 00054 #include <map> 00055 00056 namespace lama 00057 { 00058 00059 class CommunicatorManager; 00060 00074 class LAMA_DLL_IMPORTEXPORT CommunicatorFactory : NonCopyable 00075 00076 { 00077 public: 00078 00079 typedef std::map<std::string, boost::shared_ptr<CommunicatorManager> > CommunicatorToManagerMap; 00080 00089 static CommunicatorPtr get( const std::string& type, 00090 int& argc, char** & argv ); 00091 00098 static CommunicatorPtr get( const std::string& type ); 00099 00105 static CommunicatorPtr get(); 00106 00109 static CommunicatorFactory& getFactory(); 00110 00116 boost::shared_ptr<CommunicatorManager> getCommunicatorManager( const std::string& type ); 00117 00123 static void release(); 00124 00133 void addCommunicatorManager( const std::string& type, boost::shared_ptr<CommunicatorManager> manager ); 00134 00137 const std::string& getDefaultCommunicatorType() const; 00138 00141 void setDefaultCommunicatorType( const std::string& type ) const; 00142 00145 virtual ~CommunicatorFactory(); 00146 00147 private: 00148 00151 void setDefaultCommunicatorType() const; 00152 00158 CommunicatorFactory(); 00159 00162 CommunicatorToManagerMap mCommunicatorToManagerMap; 00163 00164 mutable std::string mDefaultCommunicatorType; // name of the default communicator 00165 00166 LAMA_LOG_DECL_STATIC_LOGGER(logger); 00167 }; 00168 00169 } 00170 00171 #endif // LAMA_COMMUNICATOR_FACTORY_HPP_