wavelength 1.0.0
Loading...
Searching...
No Matches
remixerupdatepacket.h
Go to the documentation of this file.
1#pragma once
2
4#include "os/mem.h"
5
13
23public:
30 ~RemixerUpdatePacket() override = default;
31
37 RemixerUpdatePacket() : mTrack(-1), mRepeat(0), mVersion(0) {
38 }
39
49 RemixerUpdatePacket(int nTrack, bool bRepeat, int nVersion)
50 : mTrack(nTrack), mRepeat(bRepeat), mVersion(nVersion) {
51 }
52
60 static Message *New();
61
68 void *operator new(size_t nSize) {
69 return PoolMemAlloc(static_cast<int>(nSize), "RemixerUpdatePacket", 0);
70 }
71
77 void operator delete(void *pBlock) {
78 PoolMemFree(pBlock);
79 }
80
88 Message *Clone() override {
89 return new RemixerUpdatePacket(*this);
90 }
91
99 int Type() override {
101 }
102
110 const char *GetName() const override {
111 return "RemixerUpdatePacket";
112 }
113
121 void PrintExtra(PrnStream &stream) const override;
122
132 void saveGuts(BinStream &stream) const override;
133
141 void restoreGuts(BinStream &stream) override;
142
144 int GetRepeat() const {
145 return mRepeat;
146 }
147
149 int GetTrack() const {
150 return mTrack;
151 }
152
154 int GetVersion() const {
155 return mVersion;
156 }
157
158private:
159 int mTrack;
160 int mRepeat;
161 int mVersion;
162};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
ExternalPacket(unsigned char nFlags=0, int nReceiver=kAllPeers)
Construct a packet from an unset sender.
Definition externalpacket.h:21
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Text output stream.
Definition prnstream.h:16
const char * GetName() const override
Report this packet's class name.
Definition remixerupdatepacket.h:110
static Message * New()
Produce a default-constructed packet on the heap.
Message * Clone() override
Produce a heap copy of this packet.
Definition remixerupdatepacket.h:88
void PrintExtra(PrnStream &stream) const override
Print the track, the repeat state, and the version.
void saveGuts(BinStream &stream) const override
Write the fields packed into one word.
void restoreGuts(BinStream &stream) override
Read the word saveGuts() writes back into the fields.
int GetRepeat() const
Definition remixerupdatepacket.h:144
RemixerUpdatePacket()
Construct a packet with no track.
Definition remixerupdatepacket.h:37
RemixerUpdatePacket(int nTrack, bool bRepeat, int nVersion)
Construct a packet with every field set.
Definition remixerupdatepacket.h:49
~RemixerUpdatePacket() override=default
Destroy the object.
int Type() override
Report this packet's registered identity.
Definition remixerupdatepacket.h:99
int GetTrack() const
Definition remixerupdatepacket.h:149
int GetVersion() const
Definition remixerupdatepacket.h:154
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.
int g_nRemixerUpdatePacketType
Identity that RemixerUpdatePacket::Type() reports.