00001
00002 #ifndef _RECEIVER_H
00003 #define _RECEIVER_H
00004
00005 #include "converse.h"
00006 #include "receiver.decl.h"
00007
00008 typedef void (* recvCallBack)(void *);
00009
00010 #define CMPI_DOUBLE_PRECISION 0
00011 #define CMPI_INTEGER 1
00012 #define CMPI_REAL 2
00013 #define CMPI_COMPLEX 3
00014 #define CMPI_LOGICAL 4
00015 #define CMPI_CHARACTER 5
00016 #define CMPI_BYTE 6
00017 #define CMPI_PACKED 7
00018
00019 class receiverMsg: public CMessage_receiverMsg
00020 {
00021 public:
00022 int tag;
00023 int sendFrom;
00024 int refno;
00025 int size;
00026 char *buf;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 };
00054
00055
00056 class receiver: public CBase_receiver
00057 {
00058 private:
00059 CmmTable msgTbl;
00060 CmmTable reqTbl;
00061 int counter;
00062 int startwaiting;
00063
00064 recvCallBack callback;
00065 void *cb_data;
00066
00067 typedef struct _tblEntry {
00068 receiverMsg *msg;
00069 char *buf;
00070 int size;
00071 } tblEntry;
00072
00073
00074 public:
00075 receiver();
00076 receiver(CkMigrateMessage *);
00077 ~receiver();
00078 void pup(PUP::er &p);
00079
00080
00081 void isend(void *buf, int count, int datatype, int dest, int tag, int refno);
00082 void irecv(void *buf, int count, int datatype, int source, int tag, int refno);
00083 int iAlltoAll(void *sendbuf, int sendcount, int sendtype,
00084 void *recvbuf, int recvcount, int recvtype, int refno);
00085 int iAlltoAllv(void *sendbuf, int *sendcount, int *sdispls, int sendtype,
00086 void *recvbuf, int *recvcount, int *rdispls, int recvtype, int refno);
00087 void iwaitAll(int refno);
00088 void iwaitAll(recvCallBack f, void *data, int refno);
00089
00090
00091 void generic(receiverMsg *);
00092 void syncSend(receiverMsg *);
00093 void ready2go();
00094
00095 private:
00096 void sendTo(receiverMsg *, int tag, char *pointer, int size, int from, int refno);
00097 void recvAlready();
00098 void pupCmmTable(CmmTable &t, PUP::er &p);
00099
00100 protected:
00101 virtual void resumeFromWait();
00102 };
00103
00104 #endif