23 fromBuffer(
const Buffer& buffer)
26 const_cast<Buffer&
>(buffer).getData(),
27 const_cast<Buffer&
>(buffer).getSize()
37 return this->m_header;
43 FW_ASSERT(this->m_header.m_type == T_START);
44 return this->m_startPacket;
50 FW_ASSERT(this->m_header.m_type == T_DATA);
51 return this->m_dataPacket;
57 FW_ASSERT(this->m_header.m_type == T_END);
58 return this->m_endPacket;
62 asCancelPacket()
const
64 FW_ASSERT(this->m_header.m_type == T_CANCEL);
65 return this->m_cancelPacket;
71 this->m_startPacket = startPacket;
72 this->m_header.m_type = T_START;
68 void FilePacket :: {
…}
78 this->m_dataPacket = dataPacket;
79 this->m_header.m_type = T_DATA;
75 void FilePacket :: {
…}
85 this->m_endPacket = endPacket;
86 this->m_header.m_type = T_END;
82 void FilePacket :: {
…}
92 this->m_cancelPacket = cancelPacket;
93 this->m_header.m_type = T_CANCEL;
89 void FilePacket :: {
…}
99 switch (this->m_header.m_type) {
103 return this->m_dataPacket.bufferSize();
105 return this->m_endPacket.bufferSize();
107 return this->m_cancelPacket.bufferSize();
117 toBuffer(
Buffer& buffer)
const
119 switch (this->m_header.m_type) {
121 return this->m_startPacket.toBuffer(buffer);
123 return this->m_dataPacket.toBuffer(buffer);
125 return this->m_endPacket.toBuffer(buffer);
127 return this->m_cancelPacket.toBuffer(buffer);
142 status = this->m_header.fromSerialBuffer(serialBuffer);
145 switch (this->m_header.m_type) {
147 status = this->m_startPacket.fromSerialBuffer(serialBuffer);
150 status = this->m_dataPacket.fromSerialBuffer(serialBuffer);
153 status = this->m_endPacket.fromSerialBuffer(serialBuffer);
156 status = this->m_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.