wavelength 1.0.0
Loading...
Searching...
No Matches
message.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4
5#include "os/binstream.h"
6#include "os/mem.h"
7#include "os/prnstream.h"
8
40class Message {
41public:
48 virtual ~Message();
49
60 virtual Message *Clone() = 0;
61
72 virtual int Type() = 0;
73
82 virtual const char *GetName() const = 0;
83
94 virtual void PrintExtra(PrnStream &stream) const;
95
106 virtual void saveGuts(BinStream &stream) const;
107
117 virtual void restoreGuts(BinStream &stream);
118
119#ifdef VIDEO_STANDARD_PAL
128 void Print(PrnStream &stream) const;
129#endif
130
142 static Message *NewMessage(int nType);
143};
144
157
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
virtual const char * GetName() const =0
Report this message's class name.
virtual void PrintExtra(PrnStream &stream) const
Write this message's payload to a diagnostic stream.
virtual int Type()=0
Report this message's registered identity.
virtual void restoreGuts(BinStream &stream)
Read this message's payload from a stream.
virtual Message * Clone()=0
Produce a heap copy of this message.
virtual void saveGuts(BinStream &stream) const
Write this message's payload to a stream.
virtual ~Message()
Vtable slot 1.
static Message * NewMessage(int nType)
Produce a message of the identified class through the factory list.
Text output stream.
Definition prnstream.h:16
BinStream & operator<<(BinStream &stream, Message *pMsg)
Write a message as its 16-bit identity and then its payload through saveGuts().
BinStream & operator>>(BinStream &stream, Message *&pMsg)
Read a message operator<<() wrote, constructing it through the factory list.