PaCO++  0.05
ParisBlockMPC.h
Go to the documentation of this file.
00001 #ifndef BASIC_DISTRIBUTION_LIBRARY_IS_DEFINED
00002 #define BASIC_DISTRIBUTION_LIBRARY_IS_DEFINED
00003 
00004 #include <DistributionLibrairie.h>
00005 #include <stdio.h>
00006 
00007 class ParisBlockMPC : public DistributionLibrary
00008 {
00009 private:
00010   PaCO::distLoc_t _mode; // ClientSide, ServerSide, CommSide
00011   PaCO::PacoTopology_t   _clttopo;
00012   PaCO::PacoTopology_t   _srvtopo;
00013   PaCO::PacoGlobalData_t _gd;
00014 
00015   // We are waiting for native type to be supported ;(
00016   LocalData_t  _ld;
00017 
00018   void* _comm; // communicator
00019 
00020   Fabrique*  _fab;
00021   Abstrait*  _darray;
00022   vAbstrait* _vdarray;
00023   int        _remaining; // number of messages to yet to be received
00024 public:
00025   // Constructors
00026   ParisBlockMPC(Fabrique* f );
00027 
00028   virtual ~ParisBlockMPC();
00029   
00030   // Comm management
00031   void setCommunicator(void* comm) {_comm = comm;}
00032 
00033   // Fabric managment
00034   void setFabric(Fabrique* f);
00035 
00036   // Reset
00037   void reset();
00038 
00039   // Methods
00040   const PaCO::distLoc_t& getMode() const;
00041 
00042   bool setMode(const PaCO::distLoc_t mode); // true if ok
00043 
00044   bool setServerConfiguration(const PaCO::PacoTopology_t & stopo);
00045   bool setClientConfiguration(const PaCO::PacoTopology_t & ctopo);
00046 
00047   bool setGlobalDataConfiguration(const PaCO::PacoGlobalData_t& gd);
00048   bool setLocalDataConfiguration (const PaCO::PacoLocalData_t&  ld);
00049 
00051   void computeSend(const void* data, vAbstrait& vdarray, vector<unsigned>& destid);
00052 
00054   bool computeReceive(Abstrait* darray);
00055 
00057   Abstrait* getResult() const ;
00058 };
00059 
00060 class ParisBlockMPC_fab : virtual public paco_individual_fabrique_lib
00061 {
00062  public:
00063   ParisBlockMPC_fab() {}
00064   ~ParisBlockMPC_fab() {}
00065   
00066   DistributionLibrary * paco_create(Fabrique* f)
00067     {
00068       return new ParisBlockMPC(f);
00069     }
00070 };
00071 #endif