New version with migration and forwarding always working. The test program also works.
[charm.git] / src / ck-com / MsgPacker.h
1 #ifndef MESSAGE_PACKER_H
2 #define MESSAGE_PACKER_H
3
4 #include "charm++.h"
5 #include "envelope.h"
6
7 #define MAX_MESSAGE_SIZE 65535
8
9 class short_envelope {
10  public:
11     UShort epIdx;
12     UShort size;  //Can only send messages up to 64KB :)    
13     CkArrayIndexMax idx;
14     char *data;
15
16     short_envelope();
17     ~short_envelope();
18     short_envelope(CkMigrateMessage *){}
19     
20     void pup(PUP::er &p);
21 };
22
23 PUPmarshall(short_envelope);
24
25 struct CombinedMessage{
26
27     char header[CmiReservedHeaderSize];
28     CkArrayID aid;
29     int srcPE;
30     int nmsgs;
31 };
32
33 PUPbytes(CombinedMessage);
34
35 class MsgPacker {        
36     CkArrayID aid;
37     short_envelope * msgList;
38     int nShortMsgs;   
39
40  public:
41     MsgPacker();
42     ~MsgPacker();    
43     MsgPacker(CkQ<CharmMessageHolder*> &cmsg_list, int n_msgs);
44     void getMessage(CombinedMessage *&msg, int &size);
45
46     static void deliver(CombinedMessage *cmb_msg);
47 };
48
49 #endif