#ifndef _DECL_WSLB_H_
#define _DECL_WSLB_H_
#include "charm++.h"
#include "LBDatabase.decl.h"

/* DECLS: readonly CkGroupID wslb;
 */

/* DECLS: message WSLBStatsMsg;
 */
class WSLBStatsMsg;
class CMessage_WSLBStatsMsg:public CkArrayMessage{
  public:
    static int __idx;
    void* operator new(size_t, const int);
    void* operator new(size_t);
    void operator delete(void *p){CkFreeMsg(p);}
    void* operator new(size_t, void*p) {return p;}
    void* operator new(size_t, int*, const int);
    void* operator new(size_t, int*);
    static void*alloc(int,size_t,int*,int);
    CMessage_WSLBStatsMsg() {};
    static void *pack(WSLBStatsMsg *p);
    static WSLBStatsMsg* unpack(void* p);
    static void __register(const char *s, size_t size, CkPackFnPtr pack, CkUnpackFnPtr unpack) {
      __idx = CkRegisterMsg(s, pack, unpack, 0, size);
    }
};

/* DECLS: message WSLBMigrateMsg;
 */
class WSLBMigrateMsg;
class CMessage_WSLBMigrateMsg:public CkArrayMessage{
  public:
    static int __idx;
    void* operator new(size_t, const int);
    void* operator new(size_t);
    void operator delete(void *p){CkFreeMsg(p);}
    void* operator new(size_t, void*p) {return p;}
    void* operator new(size_t, int*, const int);
    void* operator new(size_t, int*);
    static void*alloc(int,size_t,int*,int);
    CMessage_WSLBMigrateMsg() {};
    static void *pack(WSLBMigrateMsg *p);
    static WSLBMigrateMsg* unpack(void* p);
    static void __register(const char *s, size_t size, CkPackFnPtr pack, CkUnpackFnPtr unpack) {
      __idx = CkRegisterMsg(s, pack, unpack, 0, size);
    }
};

/* DECLS: group WSLB{
void WSLB(void);
void ReceiveStats(WSLBStatsMsg*);
void ResumeClients(void);
void ReceiveMigration(WSLBMigrateMsg*);
};
 */
class WSLB;
class CProxy_WSLB:  public virtual _CK_GID{
  public:
    static int __idx;
    static void __register(const char *s, size_t size);
    CProxy_WSLB(CkGroupID _gid) { _ck_gid = _gid; _setChare(0); }
    CProxy_WSLB(CkChareID __cid) { ckSetChareId(__cid); }
    CkChareID ckGetChareId(void) { return _ck_cid; }
    void ckSetChareId(CkChareID __cid){_CHECK_CID(__cid,__idx);_ck_cid=__cid;_setChare(1);}
    CkGroupID ckGetGroupId(void) { return _ck_gid; }
    void ckSetGroupId(CkGroupID _gid){_ck_gid=_gid;_setChare(0);}
    WSLB* ckLocalBranch(void) {
      return (WSLB *) CkLocalBranch(_ck_gid);
    }
    static WSLB* ckLocalBranch(CkGroupID gID) {
      return (WSLB *) CkLocalBranch(gID);
    }
/* DECLS: void WSLB(void);
 */
    static CkGroupID ckNew(void);
    static CkGroupID ckNewSync(void);
    CProxy_WSLB(int retEP, CkChareID *cid);
    CProxy_WSLB(void);
    static int  __idx_WSLB_void;
    static int  ckIdx_WSLB(void) { return __idx_WSLB_void; }
    static void _call_WSLB_void(void* msg, WSLB* obj);

/* DECLS: void ReceiveStats(WSLBStatsMsg*);
 */
    void ReceiveStats(WSLBStatsMsg*msg){
      if(_isChare())
        CkSendMsg(__idx_ReceiveStats_WSLBStatsMsg, msg, &_ck_cid);
      else
        CkBroadcastMsgBranch(__idx_ReceiveStats_WSLBStatsMsg, msg, _ck_gid);
    }
    void ReceiveStats(WSLBStatsMsg*msg, int onPE) {
      CkSendMsgBranch(__idx_ReceiveStats_WSLBStatsMsg, msg, onPE, _ck_gid);
    }
    void ReceiveStats(WSLBStatsMsg*msg, int npes, int *pes) {
      CkSendMsgBranchMulti(__idx_ReceiveStats_WSLBStatsMsg, msg, npes, pes, _ck_gid);
    }
    static int  __idx_ReceiveStats_WSLBStatsMsg;
    static int  ckIdx_ReceiveStats(WSLBStatsMsg*msg) { return __idx_ReceiveStats_WSLBStatsMsg; }
    static void _call_ReceiveStats_WSLBStatsMsg(void* msg, WSLB* obj);

/* DECLS: void ResumeClients(void);
 */
    void ResumeClients(void){
      void *msg = CkAllocSysMsg();
      if(_isChare())
        CkSendMsg(__idx_ResumeClients_void, msg, &_ck_cid);
      else
        CkBroadcastMsgBranch(__idx_ResumeClients_void, msg, _ck_gid);
    }
    void ResumeClients(int onPE) {
      void *msg = CkAllocSysMsg();
      CkSendMsgBranch(__idx_ResumeClients_void, msg, onPE, _ck_gid);
    }
    void ResumeClients(int npes, int *pes) {
      void *msg = CkAllocSysMsg();
      CkSendMsgBranchMulti(__idx_ResumeClients_void, msg, npes, pes, _ck_gid);
    }
    static int  __idx_ResumeClients_void;
    static int  ckIdx_ResumeClients(void) { return __idx_ResumeClients_void; }
    static void _call_ResumeClients_void(void* msg, WSLB* obj);

/* DECLS: void ReceiveMigration(WSLBMigrateMsg*);
 */
    void ReceiveMigration(WSLBMigrateMsg*msg){
      if(_isChare())
        CkSendMsg(__idx_ReceiveMigration_WSLBMigrateMsg, msg, &_ck_cid);
      else
        CkBroadcastMsgBranch(__idx_ReceiveMigration_WSLBMigrateMsg, msg, _ck_gid);
    }
    void ReceiveMigration(WSLBMigrateMsg*msg, int onPE) {
      CkSendMsgBranch(__idx_ReceiveMigration_WSLBMigrateMsg, msg, onPE, _ck_gid);
    }
    void ReceiveMigration(WSLBMigrateMsg*msg, int npes, int *pes) {
      CkSendMsgBranchMulti(__idx_ReceiveMigration_WSLBMigrateMsg, msg, npes, pes, _ck_gid);
    }
    static int  __idx_ReceiveMigration_WSLBMigrateMsg;
    static int  ckIdx_ReceiveMigration(WSLBMigrateMsg*msg) { return __idx_ReceiveMigration_WSLBMigrateMsg; }
    static void _call_ReceiveMigration_WSLBMigrateMsg(void* msg, WSLB* obj);
};

extern void _registerWSLB(void);
#endif
