wavelength 1.0.0
Loading...
Searching...
No Matches
msgsource.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5class Message;
6class MsgSink;
7
15class MsgSource {
16public:
24
31 virtual ~MsgSource();
32
40 virtual void AddSink(MsgSink *pSink);
41
51 virtual void RemoveSink(MsgSink *pSink);
52
60 void Send(Message *pMsg);
61
71
72private:
73 int mDispatchDepth; // The deliveries in progress.
74 std::list<MsgSink *> mSinks; // The sinks, with null entries removed by the next delivery.
75};
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
bool SendUntilHandled(Message *pMsg)
Deliver a message to the registered sinks in registration order until one handles it.
virtual void AddSink(MsgSink *pSink)
Register a sink, ignoring a sink that is already registered.
virtual void RemoveSink(MsgSink *pSink)
Unregister the first occurrence of a sink.
MsgSource()
Construct a source with no sinks.
void Send(Message *pMsg)
Deliver a message to every registered sink, in registration order.
virtual ~MsgSource()
Release the list of sinks.