wavelength 1.0.0
Loading...
Searching...
No Matches
shareremixpkt.h
Go to the documentation of this file.
1#pragma once
2
3#include "game/remixinfo.h"
5#include "os/mem.h"
6
13extern int g_nShareRemixPktType;
14
22public:
29 ~ShareRemixPkt() override = default;
30
36 ShareRemixPkt() = default;
37
46 ShareRemixPkt(const RemixInfo &info, int nShareOnly)
48 mShareOnly(nShareOnly) {
49 }
50
58 static Message *New();
59
66 void *operator new(size_t nSize) {
67 return PoolMemAlloc(static_cast<int>(nSize), "ShareRemixPkt", 0);
68 }
69
75 void operator delete(void *pBlock) {
76 PoolMemFree(pBlock);
77 }
78
84 Message *Clone() override {
85 return new ShareRemixPkt(*this);
86 }
87
93 int Type() override {
95 }
96
102 const char *GetName() const override {
103 return "ShareRemixPkt";
104 }
105
113 void PrintExtra(PrnStream &stream) const override;
114
122 void saveGuts(BinStream &stream) const override;
123
131 void restoreGuts(BinStream &stream) override;
132
134 const RemixInfo &GetInfo() const {
135 return mInfo;
136 }
137
140 return mInfo;
141 }
142
144 int GetShareOnly() const {
145 return mShareOnly;
146 }
147
148private:
149 RemixInfo mInfo;
150 int mShareOnly;
151};
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
InternalPacket(unsigned char nFlags=0, int nReceiver=kUnset)
Construct a packet from an unset sender.
Definition internalpacket.h:33
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
static constexpr unsigned char kFlagGuaranteed
Bit of mFlags that NetTransport::Send() turns into its guaranteed delivery bit.
Definition packet.h:28
static constexpr unsigned char kFlagOrdered
Bit of mFlags that LaunchpadRT::Send() turns into the second delivery bit of the session library.
Definition packet.h:25
static constexpr int kAllPeers
Value of mReceiver that addresses every peer.
Definition packet.h:19
Text output stream.
Definition prnstream.h:16
Description of a saved remix.
Definition remixinfo.h:26
const char * GetName() const override
Report this packet's class name.
Definition shareremixpkt.h:102
ShareRemixPkt(const RemixInfo &info, int nShareOnly)
Construct a packet for every peer, ordered and guaranteed.
Definition shareremixpkt.h:46
ShareRemixPkt()=default
Construct a packet with a reset description.
RemixInfo & GetInfo()
Definition shareremixpkt.h:139
~ShareRemixPkt() override=default
Destroy the object.
void saveGuts(BinStream &stream) const override
Write the description and mShareOnly as a byte.
Message * Clone() override
Produce a heap copy of this packet.
Definition shareremixpkt.h:84
void PrintExtra(PrnStream &stream) const override
Write the sender, the receiver, the description, and mShareOnly.
int Type() override
Report this packet's registered identity.
Definition shareremixpkt.h:93
void restoreGuts(BinStream &stream) override
Read what saveGuts() wrote, and mark the remix as received over the network.
int GetShareOnly() const
Definition shareremixpkt.h:144
static Message * New()
Produce a default-constructed packet on the heap.
const RemixInfo & GetInfo() const
Definition shareremixpkt.h:134
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_nShareRemixPktType
Identity that ShareRemixPkt::Type() reports.