PaCO++
0.05
|
00001 #ifndef _IDENTITY_H 00002 #define _IDENTITY_H 00003 00004 #include <DistributionLibrairie.h> 00005 #include "ControlledIdl.h" 00006 00007 #include "CommMatrix.h" 00008 00009 using namespace std; 00010 00014 00015 class Controlled : public DistributionLibrary 00016 { 00017 private: 00019 // Client & Server side 00020 00021 unsigned _config; // vector of bit describing which elements have been configured (cf .cc) 00022 00023 PaCO::PacoTopology_t _sTopo; // topology of the source (sender) -- SET 00024 PaCO::PacoTopology_t _dTopo; // topology of the destination (receiver) -- SET 00025 00026 unsigned _nodeRank; // id of the node (either source or destination) -- SET 00027 unsigned _unitsize; // #bytes of one element -- SET 00028 00030 // Client Side 00031 char* _clientBuffer; // pointer to the user data (set) 00032 ControlledLib::ControlledDescr _clientDescr; // contains the descr exchange between sender & destination -- SET indirectly 00033 00034 CommMatrix* _cm; 00035 CommMatrix* _remaining_cm; 00036 00037 unsigned _maxllen; 00038 00040 // Server Side 00041 unsigned _llen; // local vector size: in element -- internal 00042 unsigned long _serverToReceived; // #of element yet to be received (during an invocation) 00043 char* _serverBuffer; // Buffer where to receive the data 00044 00045 ControlledLib::ControlledDescr* _serverDescr; // contains the descr exchange between sender & destination -- SET indirectly 00046 00049 00050 public: 00051 Controlled(); 00052 virtual ~Controlled(); 00053 00054 // Common 00055 virtual void setSourceTopology(PaCO::PacoTopology_t topo); 00056 virtual PaCO::PacoTopology_t getSourceTopology(); 00057 virtual void setDestTopology(PaCO::PacoTopology_t topo); 00058 virtual PaCO::PacoTopology_t getDestTopology(); 00059 virtual void setNodeRank(long Rank); 00060 virtual long getNodeRank(); 00061 virtual void setCommunicator(void * group) {} 00062 00063 // Data description API 00064 void setEltSize(unsigned long size); 00065 void setMaxLocalLen(unsigned long elt_nb); 00066 00067 void readFromFile(char *filename); 00068 long getMaxLen(); 00069 00070 // Client Side 00071 virtual PieceToSend* computePiecesToSend(unsigned& size); 00072 virtual void setDataPtr(void* dataPtr); 00073 virtual void* getClientData(void *pid, int server_node, long & size, long & length, bool & end); 00074 virtual void* getDescr(); 00075 virtual void clientFree(); // true if com schedule to be freed 00076 00077 00078 // Server Side 00079 virtual bool insertData(void* rcptBuf, unsigned long element_nb); 00080 virtual void setDescr(void * descr); 00081 00082 virtual void* getServerData(long & length); 00083 virtual void serverFree(); 00084 00085 protected: 00086 void _setSourceTopology(unsigned long total); 00087 void _setDestTopology(unsigned long total); 00088 void _setLocalLen(unsigned long elt_nb); 00089 00090 }; 00091 00095 00096 class Controlled_fab : virtual public paco_fabrique_distribution 00097 { 00098 00099 public: 00100 Controlled_fab() {} 00101 virtual ~Controlled_fab() {} 00102 00103 DistributionLibrary *create() 00104 { 00105 return new Controlled(); 00106 } 00107 00108 }; 00109 00110 #endif