00001 #ifndef _CENTRALLBMSG_H_ 00002 #define _CENTRALLBMSG_H_ 00003 00004 #include <vector> 00005 00006 class CLBStatsMsg; 00007 00008 // this actually is not a real Charm++ message and CLBStatsMsg is just 00009 // a regular class with pup defined. 00010 class CkMarshalledCLBStatsMessage { 00011 std::vector<CLBStatsMsg *> msgs; 00012 void operator=(const CkMarshalledCLBStatsMessage &) = delete; 00013 void operator=(CkMarshalledCLBStatsMessage &&) = delete; 00014 CkMarshalledCLBStatsMessage(const CkMarshalledCLBStatsMessage&) = delete; 00015 public: 00016 CkMarshalledCLBStatsMessage(void) {} 00017 CkMarshalledCLBStatsMessage(CLBStatsMsg *m) { add(m); } //Takes ownership of message 00018 CkMarshalledCLBStatsMessage(CkMarshalledCLBStatsMessage &&rhs) : msgs(std::move(rhs.msgs)) {} 00019 ~CkMarshalledCLBStatsMessage() { free(); } 00020 void add(CLBStatsMsg *m) { if (m!=NULL) msgs.push_back(m); } 00021 void add(CkMarshalledCLBStatsMessage &&msg); // add multiple messages 00022 CLBStatsMsg *getMessage(int c=0) {CLBStatsMsg *ret=msgs[c]; msgs[c]=NULL; return ret;} 00023 int getCount() { return msgs.size(); } 00024 void pup(PUP::er &p); 00025 void free(); 00026 }; 00027 PUPmarshall(CkMarshalledCLBStatsMessage) 00028 00029 #endif