Re: [protobuf] Re: Dynamically determine the type of a message

2010-02-11 Thread Evan Jones
On Feb 11, 2010, at 15:44 , alexrichard...@gmail.com wrote: Are there known issues which arise from a union type with a large number of extensions? The problem that concerns me is that I need to have unique extension ids. This seems difficult when using Protocol Buffers as an RPC system, u

Re: Re: [protobuf] Re: Dynamically determine the type of a message

2010-02-11 Thread alexrichardson
... I think union types are the best choice for a "small" number of possible messages. However, if you really need to support *any* type of message, you could consider adding a "header" message of a known type that includes the fully-qualified message name as returned by message->GetDescr

Re: [protobuf] how to get RepeatedField object

2010-02-11 Thread Jason Hsueh
No, there isn't a way to get the RepeatedField from the reflection interface. You can only do so via the generated interface. On Thu, Feb 11, 2010 at 5:57 AM, Romain Francois < romain.francois.r.enthusi...@gmail.com> wrote: > Hello, > > How can I get hold of a RepeatedField object to manage a rep

[protobuf] how to get RepeatedField object

2010-02-11 Thread Romain Francois
Hello, How can I get hold of a RepeatedField object to manage a repeated field in C++. In RProtoBuf, we do a lot of : for( int i=0; iGetRepeatedInt32( *message, fieldDesc, i ) ; } where essentially the INTEGER macro gives a pointer to the beginning of the int array w

Re: [protobuf] Re: Dynamically determine the type of a message

2010-02-11 Thread Evan Jones
fokenrute wrote: Ok, so, I will likely opt for Enum Types. Thanks for answering. I think union types are the best choice for a "small" number of possible messages. However, if you really need to support *any* type of message, you could consider adding a "header" message of a known type that

[protobuf] Re: Dynamically determine the type of a message

2010-02-11 Thread Alessandro Bellina
Every message has a descriptor object associated. Look in the c++ API reference (http://code.google.com/apis/protocolbuffers/docs/reference/ cpp/index.html) for it. Once you get the descriptor, you can get a string type by calling name(). On Feb 10, 5:02 pm, fokenrute wrote: > Hi, I'm developing