SRS-control 0.1.4
Loading...
Searching...
No Matches
ProtoMsgReader.cpp
Go to the documentation of this file.
2#include <memory>
6#include <string_view>
7
8namespace srs::reader
9{
11 : proto_to_struct_converter_{ std::make_unique<process::Proto2StructConverter>() }
12 , proto_deserializer_{ std::make_unique<process::ProtoDeserializer>() }
13 {
14 }
15
16 ProtoMsg::~ProtoMsg() = default;
17
18 void ProtoMsg::convert(std::string_view msg, StructData& struct_data)
19 {
20 const auto& prot_struct = proto_deserializer_->convert(msg);
21 process::Proto2StructConverter::convert(prot_struct, struct_data);
22 }
23
24 auto ProtoMsg::convert(std::string_view msg) -> const StructData&
25 {
26 const auto& prot_struct = proto_deserializer_->convert(msg);
27 return proto_to_struct_converter_->convert(prot_struct);
28 }
29} // namespace srs::reader
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.