ccsinterface.C

Go to the documentation of this file.
00001 
00007 #include "ccsinterface.h"
00008 #include <conv-ccs.h>
00009 
00010 #if(CMK_CCS_AVAILABLE)
00011 #include <stdlib.h>
00012 
00013 static int shouldReply=0;
00014 static CcsDelayedReply theReply;
00015 
00016 extern "C" void CApplicationDepositNode0Data(char *data)
00017 {
00018   char *reply;
00019   int len;
00020 
00021   if(shouldReply == 0) {
00022     return; 
00023   }
00024 
00025   len = strlen(data) + 8; /* for the 'namdpr ' and '\0' */
00026   reply = (char *)malloc(len * sizeof(char));
00027   strcpy(reply, "namdpr ");
00028   strcat(reply, data);
00029   
00030   /* Do the CcsSendReply */
00031   CcsSendDelayedReply(theReply, strlen(reply) + 1, reply);
00032   shouldReply=0;
00033   free(reply);
00034 }
00035 
00036 /*Called by clients on node 0 to ask for perf. data*/
00037 void CApplicationRequestData(void)
00038 {
00039         shouldReply=1;
00040         theReply=CcsDelayReply();
00041 }
00042 
00043 void CApplicationInit(void)
00044 {
00045   CcsRegisterHandler("perf_app",(CmiHandler)CApplicationRequestData);
00046 }
00047 
00048 #endif

Generated on Tue Nov 21 01:17:11 2017 for NAMD by  doxygen 1.4.7