30 lines
628 B
C++
30 lines
628 B
C++
#pragma once
|
|
|
|
namespace f8
|
|
{
|
|
typedef std::function<void (const a8::Args&)> MsgHandleFunc;
|
|
typedef list_head* CallBackHandle;
|
|
|
|
class MsgQueue : public a8::Singleton<MsgQueue>
|
|
{
|
|
private:
|
|
MsgQueue() {};
|
|
friend class a8::Singleton<MsgQueue>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
void Update();
|
|
|
|
bool HasMsg();
|
|
CallBackHandle RegisterCallBack(int msgid, MsgHandleFunc cb);
|
|
void RemoveCallBack(CallBackHandle handle);
|
|
|
|
void PostMsg(int msgid, const a8::Args args);
|
|
|
|
private:
|
|
std::shared_ptr<class MsgQueueImp> imp_;
|
|
};
|
|
|
|
}
|