Re: [protobuf] how to get RepeatedField object

2010-02-12 Thread Romain Francois


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; isize; 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.



Re: [protobuf] marking end of record a good idea?

2010-02-12 Thread Michael Poole
Yang writes:

 currently Protocol Buffer parser moves down to the stream until it reaches end
 of buffer,

 but hadoop currently has a bug (   https://issues.apache.org/jira/browse/
 MAPREDUCE-1487  ) that presents a buffer larger than the actual 
 message
 to PB parser,
 so PB parses some junk, and fails.

 right now the only hack I have against this is to add an end-of-record tag to
 PB, so that the parser also recognizes this in addition to buffer.


 I think this could be a good idea since we proactively guard against  unsafe
 situations like the above.

Why not use something like the existing Java methods writeDelimitedTo()
and parseDelimitedFrom() to add the correct length in front of the
message?  (This is also one of the most preferred ways to store multiple
messages into a stream.  These methods currently only exist in Java, but
the same approach is straightforward to implement in C++ with
CodedInputStream::PushLimit, and I would guess that Python also gives
you a way to do it.)

Michael Poole

-- 
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.



Re: [protobuf] how to get RepeatedField object

2010-02-12 Thread Jason Hsueh
+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; isize; 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.



[protobuf] Re: Issue 66 in protobuf: cannot install using easy_install

2010-02-12 Thread protobuf

Updates:
Labels: -Component-Docs

Comment #17 on issue 66 by ken...@google.com: cannot install using  
easy_install

http://code.google.com/p/protobuf/issues/detail?id=66

I have no idea how that label got added to my previous comment.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
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.



[protobuf] Re: Issue 66 in protobuf: cannot install using easy_install

2010-02-12 Thread protobuf


Comment #18 on issue 66 by danhomerick: cannot install using easy_install
http://code.google.com/p/protobuf/issues/detail?id=66

Alright. What's the schedule for the next release? If there is one, that  
is. =)


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
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.



[protobuf] Re: Issue 66 in protobuf: cannot install using easy_install

2010-02-12 Thread protobuf


Comment #19 on issue 66 by ken...@google.com: cannot install using  
easy_install

http://code.google.com/p/protobuf/issues/detail?id=66

There's not a schedule.  I'd imagine/hope it would happen within the next  
couple

months, but can't guarantee anything.

I wish there were a way to test this without bumping the version number for  
each

attempt.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
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.