LAMA
/home/brandes/workspace/LAMA/src/lama/DistributionFactory.hpp
Go to the documentation of this file.
00001 
00036 #ifndef LAMA_DISTRIBUTION_FACTORY_HPP_
00037 #define LAMA_DISTRIBUTION_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/distribution/Distribution.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 DistributionManager;
00060 
00074 class LAMA_DLL_IMPORTEXPORT DistributionFactory : NonCopyable
00075 
00076 {
00077 public:
00078 
00079     typedef std::map<std::string, boost::shared_ptr<DistributionManager> > DistributionToManagerMap;
00080 
00088     static DistributionPtr get( const IndexType size );
00089     static DistributionPtr get( const IndexType size, const std::string& type );
00090     static DistributionPtr get( const IndexType size, const std::string& type, int arg1 );
00091     static DistributionPtr get( const IndexType size, const std::string& type, int arg1, int arg2 );
00092     static DistributionPtr get( const IndexType size, const std::string& type, const std::vector<int>& arguments );
00093 
00101     static DistributionFactory& getFactory();
00102 
00105     static void setDefaultDistribution( const std::string& type );
00106     static void setDefaultDistribution( const std::string& type, int arg1 );
00107     static void setDefaultDistribution( const std::string& type, int arg1, int arg2 );
00108 
00114     boost::shared_ptr<DistributionManager> getDistributionManager( const std::string& type );
00115 
00120     static void release();
00121 
00130     void addDistributionManager( const std::string& type, boost::shared_ptr<DistributionManager> manager );
00131 
00134     const std::string& getDefaultDistributionType() const;
00135 
00138     void setDefaultDistributionType( const std::string& type ) const;
00139 
00142     virtual ~DistributionFactory();
00143 
00144 private:
00145 
00148     void setDefaultDistributionType() const;
00149 
00155     DistributionFactory();
00156 
00159     DistributionToManagerMap mDistributionToManagerMap;
00160 
00161     mutable std::string mDefaultDistributionType;  // name of the default communicator
00162 
00163     mutable std::vector<int> mDefaultArgs;
00164 
00165     LAMA_LOG_DECL_STATIC_LOGGER( logger );
00166 };
00167 
00168 }
00169 
00170 #endif // LAMA_DISTRIBUTION_FACTORY_HPP_