+kenton

Kenton may have a better answer, but I surmise that it's to avoid tying the
Reflection interface to implementation details. A Message implementation
might not use RepeatedField at all. The original version of protobufs used a
different class to represent repeated fields, so it wouldn't have been
possible to implement Reflection for the original version if the interface
required access to RepeatedField. So maybe the reason is historical. Recent
changes have been made that would make this technically possible. However,
adding methods to get direct access to the RepeatedField would still expand
the Reflection interface quite a bit. I'll defer to Kenton on that.

On Fri, Feb 12, 2010 at 2:51 AM, Romain Francois <
romain.francois.r.enthusi...@gmail.com> wrote:

>
> Why not ? It seems reasonnable to want to use e.g. std::copy and friends.
>
> On the documentation it says :
>
> "
> Most users will not ever use a RepeatedField directly; they will use the
> get-by-index, set-by-index, and add accessors that are generated for all
> repeated fields
> "
>
> What if I do want to use RepeatedField ?
>
> Romain
>
>
> On 02/11/2010 06:50 PM, Jason Hsueh wrote:
>
>> No, there isn't a way to get the RepeatedField from the reflection
>> interface. You can only do so via the generated interface.
>>
>> On Thu, Feb 11, 2010 at 5:57 AM, Romain Francois
>> <romain.francois.r.enthusi...@gmail.com
>> <mailto:romain.francois.r.enthusi...@gmail.com>> wrote:
>>
>>    Hello,
>>
>>    How can I get hold of a RepeatedField object to manage a repeated
>>    field in C++.
>>
>>    In RProtoBuf, we do a lot of :
>>
>>    for( int i=0; i<size; i++){
>>    INTEGER(res)[i] = (int) ref->GetRepeatedInt32( *message, fieldDesc,
>>    i ) ;
>>    }
>>
>>    where essentially the INTEGER macro gives a pointer to the beginning
>>    of the int array we are filling.
>>
>>    I'd like to replace this using e.g std::copy
>>
>>    RepeatedField field ;
>>    std::copy( field.begin(), field.end(), INTEGER(res) ) ;
>>
>>    but I can't find how to actually get hold of a RepeatedField object.
>>
>>    Is it possible ?
>>
>>    Romain
>>
>
>
>
> --
> Romain Francois
> Professional R Enthusiast
> +33(0) 6 28 91 30 30
> http://romainfrancois.blog.free.fr
> |- http://tr.im/NrTG : Rcpp 0.7.5
> |- http://tr.im/MPYc : RProtoBuf: protocol buffers for R
> `- http://tr.im/KfKn : Rcpp 0.7.2
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to