You might want to look into extensions that allow to do this in a typesafe manner. http://code.google.com/apis/protocolbuffers/docs/proto.html#extensions
Whenever something is considered to be transferred in a 'generic' way, this is often a design-smell alarm. What is what you attempt to do ? On Tue, Nov 16, 2010 at 09:54, George <[email protected]> wrote: > Hi, > > I would like to create a protocol buffer message that accepts a > variety of different arguments (including other messages). I can see > two obvious ways to do that: > > message ArgInt32 { > required int32 arg = 1; > } > message ArgInt64 { > required int64 arg = 1; > } > //... > message ArgMessage { > required bytes arg = 1; > } > > message Arguments { > repeated bytes argument = 1; > } > > Where argument is serialized one of the predifined argument messages. > > Or > > message Arguments { > repeated int32 arg_int32 = 1; > repeated int64 arg_int64 = 2; > //... > repeated bytes arg_bytes = 100; > } > > Is there better way to do that? If not based on your experience which > you will prefer? > > Thanks, > George > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.
