SRS-control 0.1.4
 
Loading...
Searching...
No Matches
ProtoMsgReader.cpp
Go to the documentation of this file.
4
5namespace srs::reader
6{
8 : proto_to_struct_converter_{ std::make_unique<process::Proto2StructConverter>() }
9 , proto_deserializer_{ std::make_unique<process::ProtoDeserializer>() }
10 {
11 }
12
13 ProtoMsg::~ProtoMsg() = default;
14
15 void ProtoMsg::convert(std::string_view msg, StructData& struct_data)
16 {
17 const auto& prot_struct = proto_deserializer_->convert(msg);
18 process::Proto2StructConverter::convert(prot_struct, struct_data);
19 }
20
21 auto ProtoMsg::convert(std::string_view msg) -> const StructData&
22 {
23 const auto& prot_struct = proto_deserializer_->convert(msg);
24 return proto_to_struct_converter_->convert(prot_struct);
25 }
26} // namespace srs
static void convert(const proto::Data &proto, StructData &struct_data)
std::unique_ptr< process::Proto2StructConverter > proto_to_struct_converter_
A converter to transform Protobuf struct to native C++ struct.
~ProtoMsg()
Default destructor.
void convert(std::string_view msg, StructData &struct_data)
std::unique_ptr< process::ProtoDeserializer > proto_deserializer_
A converter to transform binary data to Protobuf struct.