23 fromBuffer(
const Buffer& buffer)
26 const_cast<Buffer&
>(buffer).getData(),
27 const_cast<Buffer&
>(buffer).getSize()
44 return this->startPacket;
51 return this->dataPacket;
58 return this->endPacket;
62 asCancelPacket()
const
65 return this->cancelPacket;
71 this->startPacket = startPacket;
72 this->header.type = T_START;
78 this->dataPacket = dataPacket;
79 this->header.type = T_DATA;
85 this->endPacket = endPacket;
86 this->header.type = T_END;
92 this->cancelPacket = cancelPacket;
93 this->header.type = T_CANCEL;
99 switch (this->header.type) {
103 return this->dataPacket.bufferSize();
105 return this->endPacket.bufferSize();
107 return this->cancelPacket.bufferSize();
117 toBuffer(
Buffer& buffer)
const
119 switch (this->header.type) {
121 return this->startPacket.toBuffer(buffer);
123 return this->dataPacket.toBuffer(buffer);
125 return this->endPacket.toBuffer(buffer);
127 return this->cancelPacket.toBuffer(buffer);
142 status = this->header.fromSerialBuffer(serialBuffer);
145 switch (this->header.type) {
147 status = this->startPacket.fromSerialBuffer(serialBuffer);
150 status = this->dataPacket.fromSerialBuffer(serialBuffer);
153 status = this->endPacket.fromSerialBuffer(serialBuffer);
156 status = this->cancelPacket.fromSerialBuffer(serialBuffer);
The type of a cancel packet.
U32 bufferSize() const
Compute the buffer size needed to hold this CancelPacket.
The type of a data packet.
The type of an end packet.
A variable-length serializable buffer.
void fill()
Fill the buffer to capacity with preexisting data.
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
@ FW_DESERIALIZE_TYPE_MISMATCH
Deserialized type ID didn't match.
The type of a start packet.