PIByteArray works on binary stream

This commit is contained in:
2022-05-10 15:23:18 +03:00
parent 0f9e592273
commit b2bc385397
58 changed files with 254 additions and 923 deletions

View File

@@ -115,8 +115,7 @@ private:
};
# pragma pack(pop)
friend PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::StartRequest & v);
friend PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::StartRequest & v);
BINARY_STREAM_FRIEND(PIBaseTransfer::StartRequest);
void processData(int id, PIByteArray &data);
PIByteArray build_packet(int id);
@@ -145,14 +144,14 @@ private:
PIString pm_string;
};
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::PacketHeader & v) {s << v.sig << v.type << v.session_id << v.id << v.crc; return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::PacketHeader & v) {s >> v.sig >> v.type >> v.session_id >> v.id >> v.crc; return s;}
BINARY_STREAM_STORE (PIBaseTransfer::PacketHeader) {s << v.sig << v.type << v.session_id << v.id << v.crc; return s;}
BINARY_STREAM_RESTORE(PIBaseTransfer::PacketHeader) {s >> v.sig >> v.type >> v.session_id >> v.id >> v.crc; return s;}
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::Part & v) {s << v.id << v.size << v.start; return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::Part & v) {s >> v.id >> v.size >> v.start; return s;}
BINARY_STREAM_STORE (PIBaseTransfer::Part) {s << v.id << v.size << v.start; return s;}
BINARY_STREAM_RESTORE(PIBaseTransfer::Part) {s >> v.id >> v.size >> v.start; return s;}
inline PIByteArray & operator <<(PIByteArray & s, const PIBaseTransfer::StartRequest & v) {s << v.packets << v.size; return s;}
inline PIByteArray & operator >>(PIByteArray & s, PIBaseTransfer::StartRequest & v) {s >> v.packets >> v.size; return s;}
BINARY_STREAM_STORE (PIBaseTransfer::StartRequest) {s << v.packets << v.size; return s;}
BINARY_STREAM_RESTORE(PIBaseTransfer::StartRequest) {s >> v.packets >> v.size; return s;}
inline PICout operator <<(PICout s, const PIBaseTransfer::Part & v) {s.setControl(0, true); s << "Part(\"" << v.id << "\", " << PIString::readableSize(v.start) << " b | " << PIString::readableSize(v.size) << " b)"; s.restoreControl(); return s;}