Re: Protobuf-lite and ParseFromIstream/SerializeToOstream

2009-08-13 Thread Handyman

Thanks.  That'll help.  I'll try the second approach you mentioned (my
messages are not complex but the chunks of data are fairly large --
often well over 100k so I didn't want to use solution #1).  If there
are any hiccups I'll post them here for posterity.

There is no answer to the question of what should go in the lite
version.  I, for one, am totally thrilled with the way it was
integrated.  All *I* miss is this native std::stream support and
solution #1 was an obvious workaround.  Thanks for the great work!

- David



On Aug 13, 3:56 pm, Kenton Varda  wrote:
> Deciding exactly where to draw the line for lite mode was hard -- different
> users want different things.
> There's two reasonable options here:
>
> 1) Read the entire istream to a string first, then call ParseFromString.
>  Similarly, when writing, use SerializeToString() then write the entire
> string to the ostream.
>
> 2) Go into the protobuf source and pull out
> src/google/protobuf/io/zero_copy_stream_impl.*.  Find the classes for
> reading from and writing to iostreams and copy them into your own project
> code.  Then use ParseFromZeroCopyStream() and SerializeToZeroCopyStream()
> with those classes.
>
> Option (1) is simpler but (2) may be a little bit more efficient if your
> messages are fairly large (probably around 100k or more).
>
> On Thu, Aug 13, 2009 at 3:48 PM, Handyman  wrote:
>
> > Those serializers seem to have been taken out for the MessageLite
> > implementation.  I'm migrating old code to the lite implementation --
> > I just create a std::ifstream/std::ofstream and hand it off to Message
> > in my old code.  Whats the best way to do this in the new code?  The
> > CodedStream stuff looks on point but the docs seem to imply that I'm
> > getting into deep internals by considering them.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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-lite and ParseFromIstream/SerializeToOstream

2009-08-13 Thread Kenton Varda
Deciding exactly where to draw the line for lite mode was hard -- different
users want different things.
There's two reasonable options here:

1) Read the entire istream to a string first, then call ParseFromString.
 Similarly, when writing, use SerializeToString() then write the entire
string to the ostream.

2) Go into the protobuf source and pull out
src/google/protobuf/io/zero_copy_stream_impl.*.  Find the classes for
reading from and writing to iostreams and copy them into your own project
code.  Then use ParseFromZeroCopyStream() and SerializeToZeroCopyStream()
with those classes.

Option (1) is simpler but (2) may be a little bit more efficient if your
messages are fairly large (probably around 100k or more).

On Thu, Aug 13, 2009 at 3:48 PM, Handyman  wrote:

>
> Those serializers seem to have been taken out for the MessageLite
> implementation.  I'm migrating old code to the lite implementation --
> I just create a std::ifstream/std::ofstream and hand it off to Message
> in my old code.  Whats the best way to do this in the new code?  The
> CodedStream stuff looks on point but the docs seem to imply that I'm
> getting into deep internals by considering them.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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-lite and ParseFromIstream/SerializeToOstream

2009-08-13 Thread Handyman

Those serializers seem to have been taken out for the MessageLite
implementation.  I'm migrating old code to the lite implementation --
I just create a std::ifstream/std::ofstream and hand it off to Message
in my old code.  Whats the best way to do this in the new code?  The
CodedStream stuff looks on point but the docs seem to imply that I'm
getting into deep internals by considering them.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@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
-~--~~~~--~~--~--~---