PaCO++  0.05
Identity.h
Go to the documentation of this file.
00001 #ifndef _IDENTITY_H
00002 #define _IDENTITY_H
00003 
00004 #include "DistributionLibrairie.h"
00005 #include "IdentityIdl.h"
00006 
00007 using namespace std;
00008 
00012 
00013 class Identity : public DistributionLibrary
00014 {
00015 private:
00017   // Client & Server side
00018 
00019   unsigned _config; // vector of bit describing which elements have been configured (cf .cc)
00020 
00021   PaCO::PacoTopology_t _sTopo; // topology of the source (sender)  -- SET
00022   PaCO::PacoTopology_t _dTopo; // topology of the destination (receiver) -- SET
00023 
00024   unsigned _nodeRank; // id of the node (either source or destination) -- SET
00025   unsigned _llen;     // local vector size: in element -- SET
00026   unsigned _unitsize; // #bytes of one element -- SET
00027 
00029   // Client Side
00030   char* _clientBuffer; // pointer to the user data (set)
00031   IdentityLib::IdentityDescr _clientDescr; // contains the descr exchange between sender & destination -- SET indirectly
00032 
00034   // Server Side
00035   unsigned long _serverToReceived; // #of element yet to be received (during an invocation)
00036   char* _serverBuffer; // Buffer where to receive the data
00037 
00038   IdentityLib::IdentityDescr* _serverDescr; // contains the descr exchange between sender & destination -- SET indirectly
00039 
00042 
00043 public:
00044   Identity();
00045   virtual ~Identity();
00046 
00047   // Common
00048   virtual void setSourceTopology(PaCO::PacoTopology_t topo); 
00049   virtual PaCO::PacoTopology_t getSourceTopology(); 
00050   virtual void setDestTopology(PaCO::PacoTopology_t topo); 
00051   virtual PaCO::PacoTopology_t getDestTopology(); 
00052   virtual void setNodeRank(long Rank);
00053   virtual long getNodeRank(); 
00054   virtual void setCommunicator(void * group) {}
00055 
00056   // Data description API
00057   void setEltSize(unsigned long size);
00058   void setLocalNbElt(unsigned long elt_nb);
00059 
00060   // Client Side
00061   virtual PieceToSend* computePiecesToSend(unsigned& size);
00062   virtual void  setDataPtr(void* dataPtr);
00063   virtual void* getClientData(void *pid, int server_node, long & size, long & length, bool & end);
00064   virtual void* getDescr();
00065   virtual void  clientFree(); // true if com schedule to be freed
00066 
00067 
00068   // Server Side
00069   virtual bool  insertData(void* rcptBuf, unsigned long element_nb);
00070   virtual void  setDescr(void * descr);
00071 
00072   virtual void* getServerData(long & length);
00073   virtual void  serverFree();
00074 
00075 };
00076 
00080 
00081 class Identity_fab : virtual public paco_fabrique_distribution
00082 {
00083 
00084  public:
00085   Identity_fab() {}
00086   virtual ~Identity_fab() {}
00087   
00088   DistributionLibrary *create()
00089     {
00090       return new Identity();
00091     }
00092 
00093 };
00094 
00095 #endif