RE: Storing complex graphs of objects?

2009-03-27 Thread Paul Runyan

Hi Kenton -

 

Thanks for your help.  Obviously defining message types in proto files is 
crucial for being able to exchange messages between different languages.  
However, as a substitute for Java serialisation having to specify message types 
in separate files from the source files seems less than ideal.  

 

What I was thinking of was more along the lines of adding methods to each 
object to be serialised via PB that look like the methods on the classes the PB 
compiler generates --- writeTo() and parseFrom().  These would work analogously 
to the way that writeObject() and readObject() for normal serialisation, but by 
trading away the unrestricted polymorhism that this type of application doesn't 
need it allow it to write ints rather than class names to distinguish types and 
would hopefully also gain from the extra efficiencies of CodedInputStream and 
CodedOutputStream.

 

Best regards,

 

Paul

_
Looking to change your car this year? Find car news, reviews and more 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641_t=762955845_r=tig_OCT07_m=EXT
--~--~-~--~~~---~--~~
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: Storing complex graphs of objects?

2009-03-27 Thread Kenton Varda
You could treat the protobuf classes as private implemnetation helpers.
 Your public interface would have methods like you describe, and internally
they'd just copy the object's state into a protocol buffer and then
serialize it.

On Fri, Mar 27, 2009 at 2:32 AM, Paul Runyan paul_run...@hotmail.comwrote:

  Hi Kenton -

 Thanks for your help.  Obviously defining message types in proto files is
 crucial for being able to exchange messages between different languages.
 However, as a substitute for Java serialisation having to specify message
 types in separate files from the source files seems less than ideal.

 What I was thinking of was more along the lines of adding methods to each
 object to be serialised via PB that look like the methods on the classes the
 PB compiler generates --- writeTo() and parseFrom().  These would work
 analogously to the way that writeObject() and readObject() for normal
 serialisation, but by trading away the unrestricted polymorhism that this
 type of application doesn't need it allow it to write ints rather than class
 names to distinguish types and would hopefully also gain from the extra
 efficiencies of CodedInputStream and CodedOutputStream.

 Best regards,

 Paul

 --
 Find car news, reviews and more Looking to change your car this 
 year?http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641_t=762955845_r=tig_OCT07_m=EXT


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