Re: [protobuf] message - group?

2010-05-03 Thread Adam Kwintkiewicz
This is important information. I make the necessary changes. Thank you.

2010/4/30 Kenton Varda 

> On Thu, Apr 29, 2010 at 3:01 PM, Adam Kwintkiewicz <
> adam.kwintkiew...@gmail.com> wrote:
>
>> They have different wire type (2; 3 and 4). They are stored in different
>> ways and because of that they have a little bit different code inside
>> parsing/serializing methods.
>
>
> The wire type and the field number combine to form the tag.  The tag is
> obviously a property of the specific field, not the message type.  So this
> affects the code you generate for that field, but should not affect the code
> you generate for the message type.
>
> Here's an example of a single message type used as both a field and a
> sub-message:
>
>   message Foo {
> optoinal group Bar = 1 { ... }
>   }
>
>   message Baz {
> optional Foo.Bar bar = 1;
>   }
>
> When serializing Foo.bar, you need to use group encoding, but when
> serializing Baz.bar, you need to use sub-message encoding.
>
>
>>
>>
>> 2010/4/29 Kenton Varda 
>>
>>> Why do you need to generate different code for the two?  All the official
>>> code generators generate exactly the same code for message classes whether
>>> they be nested messages or groups.  Version 1 of protocol buffers generated
>>> different classes and it proved to be an enormous pain.
>>>
>>> On Thu, Apr 29, 2010 at 2:04 PM, Adam Kwintkiewicz <
>>> adam.kwintkiew...@gmail.com> wrote:
>>>
 hmm this is a slight problem. I am iterating over the nested messages
 and then generating a message/group code. I don't have reference to the
 specific field

 2010/4/29 Kenton Varda 

 A single message type can be used as both a message and as a group, so
> there is no way to tell which it is from the Descriptor.  You have to have
> the FieldDescriptor in the containing message.
>
>
> On Thu, Apr 29, 2010 at 1:36 PM, adamdms 
> wrote:
>
>> how to check whether the current message (Descriptor *) is a group?
>>
>> --
>> 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.
>>
>>
>

>>>
>>
>

-- 
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] message - group?

2010-04-29 Thread Kenton Varda
On Thu, Apr 29, 2010 at 3:01 PM, Adam Kwintkiewicz <
adam.kwintkiew...@gmail.com> wrote:

> They have different wire type (2; 3 and 4). They are stored in different
> ways and because of that they have a little bit different code inside
> parsing/serializing methods.


The wire type and the field number combine to form the tag.  The tag is
obviously a property of the specific field, not the message type.  So this
affects the code you generate for that field, but should not affect the code
you generate for the message type.

Here's an example of a single message type used as both a field and a
sub-message:

  message Foo {
optoinal group Bar = 1 { ... }
  }

  message Baz {
optional Foo.Bar bar = 1;
  }

When serializing Foo.bar, you need to use group encoding, but when
serializing Baz.bar, you need to use sub-message encoding.


>
>
> 2010/4/29 Kenton Varda 
>
>> Why do you need to generate different code for the two?  All the official
>> code generators generate exactly the same code for message classes whether
>> they be nested messages or groups.  Version 1 of protocol buffers generated
>> different classes and it proved to be an enormous pain.
>>
>> On Thu, Apr 29, 2010 at 2:04 PM, Adam Kwintkiewicz <
>> adam.kwintkiew...@gmail.com> wrote:
>>
>>> hmm this is a slight problem. I am iterating over the nested messages and
>>> then generating a message/group code. I don't have reference to the specific
>>> field
>>>
>>> 2010/4/29 Kenton Varda 
>>>
>>> A single message type can be used as both a message and as a group, so
 there is no way to tell which it is from the Descriptor.  You have to have
 the FieldDescriptor in the containing message.


 On Thu, Apr 29, 2010 at 1:36 PM, adamdms 
 wrote:

> how to check whether the current message (Descriptor *) is a group?
>
> --
> 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.
>
>

>>>
>>
>

-- 
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] message - group?

2010-04-29 Thread Adam Kwintkiewicz
They have different wire type (2; 3 and 4). They are stored in different
ways and because of that they have a little bit different code inside
parsing/serializing methods.

2010/4/29 Kenton Varda 

> Why do you need to generate different code for the two?  All the official
> code generators generate exactly the same code for message classes whether
> they be nested messages or groups.  Version 1 of protocol buffers generated
> different classes and it proved to be an enormous pain.
>
> On Thu, Apr 29, 2010 at 2:04 PM, Adam Kwintkiewicz <
> adam.kwintkiew...@gmail.com> wrote:
>
>> hmm this is a slight problem. I am iterating over the nested messages and
>> then generating a message/group code. I don't have reference to the specific
>> field
>>
>> 2010/4/29 Kenton Varda 
>>
>> A single message type can be used as both a message and as a group, so
>>> there is no way to tell which it is from the Descriptor.  You have to have
>>> the FieldDescriptor in the containing message.
>>>
>>>
>>> On Thu, Apr 29, 2010 at 1:36 PM, adamdms wrote:
>>>
 how to check whether the current message (Descriptor *) is a group?

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


>>>
>>
>

-- 
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] message - group?

2010-04-29 Thread Kenton Varda
Why do you need to generate different code for the two?  All the official
code generators generate exactly the same code for message classes whether
they be nested messages or groups.  Version 1 of protocol buffers generated
different classes and it proved to be an enormous pain.

On Thu, Apr 29, 2010 at 2:04 PM, Adam Kwintkiewicz <
adam.kwintkiew...@gmail.com> wrote:

> hmm this is a slight problem. I am iterating over the nested messages and
> then generating a message/group code. I don't have reference to the specific
> field
>
> 2010/4/29 Kenton Varda 
>
> A single message type can be used as both a message and as a group, so
>> there is no way to tell which it is from the Descriptor.  You have to have
>> the FieldDescriptor in the containing message.
>>
>>
>> On Thu, Apr 29, 2010 at 1:36 PM, adamdms wrote:
>>
>>> how to check whether the current message (Descriptor *) is a group?
>>>
>>> --
>>> 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.
>>>
>>>
>>
>

-- 
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] message - group?

2010-04-29 Thread Adam Kwintkiewicz
hmm this is a slight problem. I am iterating over the nested messages and
then generating a message/group code. I don't have reference to the specific
field

2010/4/29 Kenton Varda 

> A single message type can be used as both a message and as a group, so
> there is no way to tell which it is from the Descriptor.  You have to have
> the FieldDescriptor in the containing message.
>
>
> On Thu, Apr 29, 2010 at 1:36 PM, adamdms wrote:
>
>> how to check whether the current message (Descriptor *) is a group?
>>
>> --
>> 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.
>>
>>
>

-- 
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] message - group?

2010-04-29 Thread Kenton Varda
A single message type can be used as both a message and as a group, so there
is no way to tell which it is from the Descriptor.  You have to have the
FieldDescriptor in the containing message.

On Thu, Apr 29, 2010 at 1:36 PM, adamdms wrote:

> how to check whether the current message (Descriptor *) is a group?
>
> --
> 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.
>
>

-- 
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] message - group?

2010-04-29 Thread adamdms
how to check whether the current message (Descriptor *) is a group?

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