SRS-control 0.1.4
 
Loading...
Searching...
No Matches
ProtoSerializer.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace srs::process
6{
7 const auto protobuf_deserializer_converter = [](const proto::Data& proto_data, std::string& output_data) -> int
8 {
9 namespace protobuf = google::protobuf;
10 namespace io = protobuf::io;
11 auto output_stream = io::StringOutputStream{ &output_data };
12 proto_data.SerializeToZeroCopyStream(&output_stream);
13 return 0;
14 };
15
16 class ProtoSerializer : public ProtoSerializerBase<decltype(protobuf_deserializer_converter)>
17 {
18 public:
19 explicit ProtoSerializer(asio::thread_pool& thread_pool)
20 : ProtoSerializerBase{ thread_pool, "ProtoSerializer", protobuf_deserializer_converter }
21 {
22 }
23 static constexpr auto ConverterOption = std::array{ proto };
24 };
25} // namespace srs
ProtoSerializerBase(asio::thread_pool &thread_pool, std::string name, decltype(protobuf_deserializer_converter) converter)
ProtoSerializer(asio::thread_pool &thread_pool)
static constexpr auto ConverterOption
const auto protobuf_deserializer_converter