[protobuf] How to use SetString reflection method

2010-08-06 Thread mark.t.macdon...@googlemail.com
Can you please give me an example of using the reflection SetString method? //this compiles reflection-GetString(fractal_handle,fractal.GetDescriptor()- FindFieldByName(name)); //this doesn't reflection-SetString(fractal_handle,fractal.GetDescriptor()- FindFieldByName(name),Mandlebrot);

[protobuf] Setting a nested message field without making a pointer?

2010-08-04 Thread mark.t.macdon...@googlemail.com
I have a message which describes an image: message Image { required int32 width = 1; required int32 height = 2; optional string name = 3; message Pixel { required int32 red = 1; required int32 green = 2; required int32 blue = 3; optional int32 alpha = 4; } repeated Pixel pixels =

[protobuf] C++ syntax: how to set a singular enum field

2010-07-16 Thread mark.t.macdon...@googlemail.com
I have the following message: message device { enum Retraction { HOUSED = 0; EXTENDED = 1; } optional Retraction retraction = 1; } How do I fix my syntax to set the retraction field (below)? int main() { device dev; if (stabiliser.retraction()==RR_system::HOUSED) coutTrue\n;

[protobuf] Re: C++ syntax: how to set a singular enum field

2010-07-16 Thread mark.t.macdon...@googlemail.com
There was a typo in my original question. Should read: int main() { device dev; //this works if (stabiliser.retraction()==device::HOUSED) coutTrue\n; //but this doesn't compile stabiliser.set_retraction(device::RETRACTED); } -- You received this message because you are subscribed to the

[protobuf] message-GetDescriptor() vs message-descriptor();

2010-07-15 Thread mark.t.macdon...@googlemail.com
Both the following work in my code: const Descriptor* d=message-GetDescriptor(); const Descriptor* d=message-descriptor(); What's the difference and which should I use? Thanks! -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to

[protobuf] Help with basic concepts of descriptors and reflection

2010-07-15 Thread mark.t.macdon...@googlemail.com
1. Is there anything incorrect in my understanding so far?: * Descriptors = INTROSPECTION (querying the message structure at runtime) * Reflection = Introspection + MODIFYING the message structure at runtime * Descriptors and Reflection are implemented as C++ structures with member functions *

[protobuf] Why do field default values not get serialised?

2010-07-14 Thread mark.t.macdon...@googlemail.com
I am new and want to understand the purpose/usage of default values in the .proto file. E.g: test { optional string a 1 [default =test]; } When I create a message object and read the field value, the default will be displayed: test thing; coutthing.a(); But when I serialise, write to a file,

[protobuf] Design advice: variability (at runtime) on the number of fields in a message

2010-07-14 Thread mark.t.macdon...@googlemail.com
Let's assume I'm designing a distributed (client-server) application. The server owns a bunch of parameters. The client (GUI) is to be periodically updated when any of their values change. I could: i) send a small wire message containing one field each time it changes ii) periodically send a big

[protobuf] Protoc error on Linux Mint (protoc-gen-ccp: program not found)

2010-06-02 Thread mark.t.macdon...@googlemail.com
Hi, I'm running Linux Mint, and trying to get started with protobuf-2.3.0. My install was as follows (no problems reported that I could see): ./configure --prefix=/usr make clean make check sudo make install I then created a directory with a simple .proto file and executed: protoc --ccp_out=.