1

I want to modify the data structure defined in protobuf, the proto is like this:

message DoubleMap {
   map<string, double> double_map = 1
}

message DoubleVector {
   map<string, DoubleMap> double_vector = 1
}

message Data {
   repeated DoubleVector data = 1
}

I need to new, modify and delete on Data, it's much easier if the data structure is defined in C++. My question is do I need to have a Loader that take a protobuf input and build a data structure in C++? Or build my own helper functions based on protobuf generated functions?

superd
  • 305
  • 4
  • 10
  • 1
    What's wrong with the C++ classes generated by `protoc` compiler from your .proto definition? What do they lack that you feel you need? – Igor Tandetnik Dec 21 '17 at 19:18
  • "do I need" how do you expect somebody would tell you what you need? – Slava Dec 21 '17 at 19:39
  • If given `Data d`, I want to access one double value in DoubleMap,like `d.data.double_vector.double_map["key"]`. Then if I just use the helper functions in the protoc generated code then it's super long. – superd Dec 21 '17 at 20:19

1 Answers1

0

According the protobuf doc, google encourages you to write wrappers:

Google encourages to write wrappers

superd
  • 305
  • 4
  • 10