2022-09-25 21:49:24 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
|
|
// for Raspberry Pi
|
|
|
|
//
|
|
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
|
|
//
|
2022-10-04 15:23:42 +00:00
|
|
|
// Helper for serializing/deserializing protobuf messages
|
2022-09-25 21:49:24 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "google/protobuf/message.h"
|
2022-10-04 15:23:42 +00:00
|
|
|
#include <vector>
|
2022-09-25 21:49:24 +00:00
|
|
|
|
2022-10-06 14:15:19 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2022-10-04 15:23:42 +00:00
|
|
|
class ProtobufSerializer
|
2022-09-25 21:49:24 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2022-10-04 15:23:42 +00:00
|
|
|
ProtobufSerializer() = default;
|
|
|
|
~ProtobufSerializer() = default;
|
2022-09-25 21:49:24 +00:00
|
|
|
|
|
|
|
void SerializeMessage(int, const google::protobuf::Message&) const;
|
|
|
|
void DeserializeMessage(int, google::protobuf::Message&) const;
|
|
|
|
size_t ReadBytes(int, vector<byte>&) const;
|
|
|
|
};
|