kodi
|
Public Member Functions | |
NPT_MessageHandlerProxy (NPT_MessageHandler *handler) | |
Create a proxy for a message handler. More... | |
void | OnMessage (NPT_Message *) override |
NPT_Result | HandleMessage (NPT_Message *message) override |
void | DetachHandler () |
Detach the proxy from the handler implementation. More... | |
void | AddReference () |
Increment the reference count. | |
void | Release () |
Decrement the reference count and delete if 0. | |
NPT_MessageHandlerProxy::NPT_MessageHandlerProxy | ( | NPT_MessageHandler * | handler | ) |
Create a proxy for a message handler.
All calls to HandleMessage() and OnMessage() on the proxy are automatically forwarded to the handler. This class is useful in cases where a handler is passed asynchronously (for example in a message queue) and one wishes to guarantee right away that no more calls to the handler will be made (because, for example, the handler needs to be deleted).
The proxy object keeps a pointer to the handler, but does not own it.
void NPT_MessageHandlerProxy::DetachHandler | ( | ) |
Detach the proxy from the handler implementation.
After this call returns, calls will no longer be forwarded to the handler object. It is then safe, for example, to delete the handler.