Hi Kenton, thank you for the answer concerning Builder field assignment from a Reader. I will check whether this works in pycapnp out of the box, but knowing that it's already supported in C++ is very encouraging.
On Monday, February 27, 2017 at 3:24:08 PM UTC-8, Kenton Varda wrote: > > On Thu, Feb 16, 2017 at 4:27 PM, vitaly numenta <[email protected] > <javascript:>> wrote: > >> Hi Kenton - thank you for the insights. Regarding >> >> In Python, you could read the message with a MessageReader and then copy >>> the contents into the branch of the final message. >> >> >> So, the Python side would have a MessageBuilder. To read the branch >> message with a MessageReader in python, we would use the from_segments >> method, which would make use of the SegmentReader under the covers. >> However, I am a bit stomped how to do the last part, namely how to copy the >> contents of the MessageReader into the branch of the final message. I >> couldn't find the way to do that in both pycapnp and capnproto. How would >> you copy the contents of the MessageReader into a branch of a >> MessageBuilder in capnproto in c++? >> > > Does a regular assignment work? > > parent_struct_builder.some_field = some_struct_reader > > In C++, we generate a "setFoo()" method for each struct-typed field that > takes a Reader as the parameter and makes a copy. > > -Kenton > -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
