If I'm understanding your question correctly, you are asking about setting
nested message values in a proto using the C++ API. The protobuf
documentation provides an example of doing this at
https://developers.google.com/protocol-buffers/docs/cpptutorial#writing-a-message
.



On Thu, Mar 9, 2017 at 11:02 AM, Anirudh Kasturi <[email protected]>
wrote:

> Hello folks,
>
> I have a 2D array emulation in my proto file.
>
> In C++, after generating the protobuf files,  I see I have methods
> declared for adding "columns" (add_columns) in the pb.h  without any
> parameters.  Also there is another method declared to add "records"
> (add_records) in the pb.h without any parameters.
>
> In Java the generated functions accept message builder as a parameter and
> it is easy to construct the request.
>
> In C++ for fields in proto file with standard datatypes like string and
> int I have setters that accept the string and int as parameters.  For type
> google.protobuf.Value or type Record, I have no parameters.
>
> Here is the code.  How can I populate the request with the "columns"
> values of type google.protobuf.Value and "records" values of type Record?
> Any help is appreciated.  Thank you !
>
> message DataMessage {
>
>         int32 Status = 1;
>
>         int32 Entries = 2;
>
>         repeated string columnNames = 4;
>
>
>         // By repeating this message, we somewhat emulate a 2D array
>
>         message Record {
>
>                 repeated google.protobuf.Value columns = 1;
>
>         }
>
>         repeated Record records = 5;
>
> }
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/8da02464-6e75-43d1-90f8-ba8ff97cc515%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/8da02464-6e75-43d1-90f8-ba8ff97cc515%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CALUXJ7i5yJPLH-twqG3PWYvC2mcxNU2e9NMZ9%2Bn0t2ghyV6MKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to