wavelength 1.0.0
Loading...
Searching...
No Matches
msgsink.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5#include "os/mem.h"
6
7class Message;
8
21class MsgSink {
22public:
32 void *operator new(size_t nSize) {
33 return PoolMemAlloc(static_cast<int>(nSize), "MsgSink", 0);
34 }
35
44 void operator delete(void *pBlock) {
45 PoolMemFree(pBlock);
46 }
47
52 virtual ~MsgSink();
53
65 virtual bool Dispatch(Message *pMsg);
66
76 virtual bool DispatchPriv(Message *pMsg) = 0;
77};
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Receiver of engine messages.
Definition msgsink.h:21
virtual bool DispatchPriv(Message *pMsg)=0
Act on a message.
virtual ~MsgSink()
virtual bool Dispatch(Message *pMsg)
Accept a message.
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.