The protos would be a chain ... e.g. lets say I have A.proto , B.proto,
C.proto, D.proto

Message A{
     optional  B b;

Message B{
     optional C c;

Message C{
     optional D d;

Message D{
    optional int e;

And i get a message of type A. Currently I have a recursive function
traverse(Message *)
when I get A, I switch on the CPP TYPE of each field it has and call
traverse recursively with A->getMessage or A->getRepeatedMessage depending
on the kind of field.

For the solution I want, I can keep a stack of field names, and keep pushing
into  it for every recursive call till I see 'e'. At that point I can
concatenate all field names in the stack and get A.B.C.D.e as the fully
qualified name of 'e'.
Is there an easier way?

On Mon, Jun 1, 2009 at 6:22 PM, Kenton Varda <> wrote:

> Sorry, I don't understand your question.  Can you write out the
> hypothetical .proto file that defines these types, and example code showing
> what you imagine the solution looking like?
> On Mon, Jun 1, 2009 at 3:44 PM, ajoy <> wrote:
>> Hi,
>> If I have a chain of enclosed messages, e.g. A->B->C->D->e
>> where e is a scalar at the end of the chain, and I'm dynamically
>> parsing it, and looking at e, is there a way to get A.B.C.D.e as the
>> fully qualified name?
>> thanks
>> >>

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to