charmxi cleanup: rename atomic construct to serial internally
[charm.git] / src / ck-core / ckcallback-ccs.h
blob86a40a96c4529a91763dadc479087f9f2f8b9cc8
1 /*
2 Make CCS call a CkCallback instead of a flat C function.
4 Initial version by Orion Sky Lawlor, olawlor@acm.org, 2/8/2002
5 */
6 #ifndef _CKCALLBACK_CCS_H_
7 #define _CKCALLBACK_CCS_H_
9 #include "charm++.h" /*for CkCallback, etc.*/
10 #include "conv-ccs.h" /*for CcsDelayedReply struct*/
11 #include "CkCallback.decl.h" /*for CMessage_CkCcsRequestMsg*/
13 /**
14 * Message sent from CCS to callbacks.
15 * You must eventually call CcsSendDelayedReply(msg->reply,...)
16 * for each CCS-called callback.
18 class CkCcsRequestMsg : public CMessage_CkCcsRequestMsg {
19 public:
20 CcsDelayedReply reply; /*Object to send reply to*/
21 int length; //Number of bytes of request data.
22 char *data; //Actual data sent along with request.
25 /**
26 * Very generic message type: contains a bunch of bytes.
28 class CkDataMsg : public CMessage_CkDataMsg {
29 public:
30 int length; //Number of bytes of data below.
31 char *data; //Message data.
32 int checkTag; // For detecting message corruption
34 inline int getLength(void) const {return length;}
35 inline int getSize(void) const {return length;}
36 inline void *getData(void) const {return data;}
38 /// This is how you must create a CkDataMsg
39 static CkDataMsg *buildNew(int length,const void *data);
41 void check(void);
45 #ifdef CcsRegisterHandler /*pollution from C conv-ccs header*/
46 # undef CcsRegisterHandler
47 #endif
49 /**
50 * When a CCS request comes in from the network with this handlername,
51 * call this callback with an appropriate CkCcsRequestMsg.
52 * You must eventually call CcsSendDelayedReply(msg->reply,...)
53 * each time this callback is activated.
55 * Unlike the regular converse CcsRegisterHandler (in conv-ccs.h),
56 * this call need only be made once, on processor 0, and all processors
57 * will be able to respond to the CCS request.
59 void CcsRegisterHandler(const char *ccs_handlername,const CkCallback &cb);
62 #endif