PaCO++  0.05
ParisBlock.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 #include "Type.h" // For ParisBlock_param_t 
00008 
00009 class ParisBlock : public DistributionLibrary
00010 {
00011 private:
00012   PaCO::distLoc_t _mode; // ClientSide, ServerSide, CommSide
00013   PaCO::PacoTopology_t   _clttopo;
00014   PaCO::PacoTopology_t   _srvtopo;
00015   PaCO::PacoGlobalData_t _gd;
00016 
00017   // We are waiting for native type to be supported ;(
00018   LocalData_t  _ld;
00019 
00020   void* _comm; // communicator
00021 
00022   Fabrique*  _fab;
00023   Abstrait*  _darray;
00024   vAbstrait* _vdarray;
00025   int        _remaining; // number of messages to yet to be received
00026 
00027   // hum
00028   ParisBlock_param_t _param;
00029 
00030 public:
00031   // Constructors
00032   ParisBlock(Fabrique* f );
00033 
00034   ParisBlock(Fabrique* f, unsigned int blocksize );
00035 
00036   virtual ~ParisBlock();
00037   
00038   // Comm management
00039   void setCommunicator(void* comm) { _comm = comm;}
00040 
00041   // Fabric managment
00042   void setFabric(Fabrique* f);
00043 
00044   // Reset
00045   void reset();
00046 
00047   // Methods
00048   const PaCO::distLoc_t& getMode() const;
00049 
00050   bool setMode(const PaCO::distLoc_t mode); // true if ok
00051 
00052   bool setServerConfiguration(const PaCO::PacoTopology_t & stopo);
00053   bool setClientConfiguration(const PaCO::PacoTopology_t & ctopo);
00054 
00055   bool setGlobalDataConfiguration(const PaCO::PacoGlobalData_t& gd);
00056   bool setLocalDataConfiguration (const PaCO::PacoLocalData_t&  ld);
00057 
00058   int   setConfig(void * config);
00059   void* getConfig();
00060 
00062   void computeSend(const void* data, vAbstrait& vdarray, vector<unsigned>& destid);
00063 
00065   bool computeReceive(Abstrait* darray);
00066 
00068   Abstrait* getResult() const ;
00069 };
00070 
00071 class ParisBlock_fab : virtual public paco_individual_fabrique_lib
00072 {
00073 
00074  public:
00075   ParisBlock_fab() {}
00076   ~ParisBlock_fab() {}
00077   
00078   DistributionLibrary * paco_create(Fabrique* f)
00079     {
00080       return new ParisBlock(f);
00081     }
00082 
00083 };
00084 #endif