#ifndef _GROUPCAST_H
#define _GROUPCAST_H

#include "megatest.h"
#include "groupcast.decl.h"

class groupcast_SimpleMsg : public CMessage_groupcast_SimpleMsg {
public:
  int gid;
  CkChareID mainhandle;
};

class groupcast_BCMsg : public CMessage_groupcast_BCMsg {
private:
  char checkString[11];
public:
  groupcast_BCMsg(void) { sprintf(checkString, "Broadcast!");} 
  groupcast_BCMsg(CkMigrateMessage *m) {}
  int check(void) { 
    if (strcmp("Broadcast!", checkString) == 0)
      return 1;
    else
      return 0;
  }
};

class groupcast_main : public Chare {
private:
  int gid;
  int count;
public:
  groupcast_main(void);
  groupcast_main(CkMigrateMessage *m) {}
  void reply(groupcast_SimpleMsg *em);
};

class groupcast_group : public Group {
private:
  CkChareID myMain;
public:
  groupcast_group(groupcast_SimpleMsg *sm);
  groupcast_group(CkMigrateMessage *m) {}
  void doBroadcast(groupcast_BCMsg *bcm);
};

#endif
