[protobuf] C++0x enum class

2011-08-23 Thread Christopher Head
Hi, Does anyone know if Protobuf's C++ output is ever going to support enum classes? I'd like to be able to define the elements of my enum in just one place (i.e. in the message definition file) and then use that definition throughout my program, but I'd like it to be defined as an enum class

Re: [protobuf] Getting Errrors while building like: undefined reference to `google::protobuf::Message::SpaceUsed() const'

2011-09-26 Thread Christopher Head
Did you include the output of pkg-config --libs protobuf in your linker command line? Chris On Sat, 24 Sep 2011 03:18:16 -0700 (PDT) $ag@r Takawane [B-08] sagartakaw...@gmail.com wrote: Hi all, I have compiled protobuf code(.cc generated by protoc), its wrapper(.cc c files) and made .a

Re: [protobuf] Return the Message type?

2011-09-26 Thread Christopher Head
Assuming you have a MyMessage, use the has_messagecommand() and has_messageclose() functions to figure out whether each optional field is present or absent. Chris On Mon, 26 Sep 2011 10:37:48 -0700 (PDT) EJ j.gra...@gmail.com wrote: Hello, I'm new to protocol buffers, so this may be a very

[protobuf] Re: Using protocol buffers with sockets

2011-09-30 Thread Christopher Head
Did you remember to delimit your protobuf messages when sending them over your sockets? Your use of send() suggests you're using a stream socket and not a datagram socket (though that's no guarantee). If you tell Protobuf to decode starting from the wrong place, or don't give it a full message, or

Re: [protobuf] Java and C++ exchange via socket

2011-10-06 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On Wed, 5 Oct 2011 02:48:39 -0700 (PDT) yorick yorick.bru...@gmail.com wrote: [snip] Java : Socket sock;

Re: [protobuf] Re: Java and C++ exchange via socket

2011-10-06 Thread Christopher Head
On Thu, 6 Oct 2011 01:00:37 -0700 (PDT) yorick yorick.bru...@gmail.com wrote: I have now for the Java (this is unchanged) : -- IRobotData data = getRobotData(); System.out.println(phi:+data.getPhi()+, distance:+data.getDistance()); int serDataSize =

Re: [protobuf] Trying to create a new message from command line input

2011-10-11 Thread Christopher Head
What seems to be the problem? I just created a simple test case that seems to work perfectly. My proto file looks like this: CUT HERE message Outer { message Inner { required int32 foo = 1; } optional Inner inner = 1; } CUT HERE My C++ source file looks

Re: [protobuf] Re: Message is not encoded correctly when an enum value set to zero

2011-10-24 Thread Christopher Head
Not happening for me. -- message.proto -- enum Value { V1 = 0; V2 = 1; V3 = 2; } message Message { required Value value = 1; required int32 integer = 2; required string text = 3; } -- test.cpp -- #include message.pb.h #include iostream #include

Re: [protobuf] Why protocol buffer c++ library not reading binary objects properly?

2011-12-09 Thread Christopher Head
Protobuf messages are not aware of their own sizes, and you haven't told the input stream how many bytes of message it should consume. Try this: coded_input-ReadLittleEndian32(objtype); coded_input-ReadLittleEndian32(objlen); CodedInputStream::Limit lim = coded_input-PushLimit(objlen);

Re: [protobuf] Storing protocol buffers: binary vs. text

2011-12-11 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 If you're worried, just spec your format such that when you write a binary-format file, you shove a magic unprintable signature on the front. Now when you want to load data, try to parse it as binary first (looking for the signature) and, if it

Re: [protobuf] Libraries to used in a project

2011-12-15 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 If you use the lite library instead of the full library, you lose reflection/introspection (the ability to dynamically explore messages without knowing at compile-time what type of message you're looking at). As long as all you want to do is

Re: [protobuf] Behavior when an optional field exists twice in a protobuf message

2012-04-17 Thread Christopher Head
On Tue, 17 Apr 2012 12:54:38 +0200 Martin Hellmich mhell...@cern.ch wrote: Hi! I am using google protocol buffers in C++ with memcached and I am using the memcached_append command to edit lists. I would like to know what happens if I append an item, which is not a repeated field. I

Re: [protobuf] How to determine if the input is malformed? (C++, MessageLite::ParseFromCodedStream)

2012-09-12 Thread Christopher Head
Protobuf messages do not have inherent delimiters; in fact, the concatenation of two messages can sometimes be a perfectly valid single message. Add delimiters in your protocol (if you are only sending a single message then just shutdown() the socket afterwards and have the recipient read until

Re: [protobuf] c++: Best way to recv a serialized protocol buffer?

2012-09-14 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 You need to know how long the data will be, since Protobuf doesn’t tell you that. Your protocol somehow decides that. Either you receive up to EOF and that’s a message, or else the length of the message appears in front of the message itself. I

Re: [protobuf] Missing input file error

2012-11-07 Thread Christopher Head
Hi, The -I option specifies where to look for files you refer to with “import”. It is not used for the file you are trying to compile. You want this: protoc --cpp_out=/home/m/Projects /home/m/AddressBook.proto If “AddressBook.proto” imports other proto files, you may then need to add a -I

Re: [protobuf] c++ to java issue (zero tag)

2012-12-05 Thread Christopher Head
On Wed, 5 Dec 2012 07:37:40 -0800 (PST) valadas valadas.gonc...@gmail.com wrote: *FileinputStream pipe = new FileinputStream(pipeName);* *char buffer = new char[4096];* ** *pipe.read(buffer);* * MessagesProtos.OperationalMessage message =

Re: [protobuf] will protoc accept scalar typedefs ?

2013-02-19 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On Fri, 8 Feb 2013 01:08:40 -0800 (PST) RichM richardmur...@richardmurphy.demon.co.uk wrote: it would be nice if i could do typedef int ClientID it appears not possible ? tks Richard. Could you use the decltype() operator against a

Re: [protobuf] Binary Message between Client and Server

2013-02-25 Thread Christopher Head
See https://developers.google.com/protocol-buffers/docs/cpptutorial, the section on required, optional, and repeated fields. The general answer is yes, there’s full backwards and forwards compatibility between different versions of protobuf and different versions of your message, except that the

Re: [protobuf] Unable to decode raw a protobuf binary file

2013-02-27 Thread Christopher Head
After unpacking your RAR file to get protobuff.log, I examined that file. I believe that file is not a single message, but a set of messages, and each message has a big-endian uint32 stuck in front of it which is the length of the following message. For example, the first four bytes are 0x00,

Re: [protobuf] How to avoid error C2662 on nested messages

2013-05-13 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Use the mutable_header() function instead. This creates the contained object if it does not already exist, and returns a pointer instead of a reference. Chris On Mon, 13 May 2013 02:34:49 -0700 (PDT) Barzo dba...@gmail.com wrote: Hi, I have

Re: [protobuf] New syntax for packed message elements: Example. packed uint32 my_element = 1;

2013-05-23 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On Thu, 23 May 2013 09:31:13 -0700 (PDT) Ruffian Eo ruffia...@googlemail.com wrote: Ever since I first used protocol buffers, the construct [packed=true] appeared like a temporary hack to me. Here my proposal: Alternate syntax (with same

Re: [protobuf] Question about size/speed of protobufs with different formats

2013-08-06 Thread Christopher Head
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Wouldn’t it be even smaller to do this message Packet { repeated uint32 pids = 1 [packed=true]; repeated string execnames = 2; } working under the assumption that the two repeated fields will be the same length? You will burn two

Re: [protobuf] ParseFromString fails for message containing a single required float

2013-08-15 Thread Christopher Head
On Thu, 15 Aug 2013 08:48:42 -0700 (PDT) Nikolas Engelhard engelhard.niko...@gmail.com wrote: Hello I have a strange problem and need some assistance: I just started using protobuf and transmit the serialized messages via TCP-Sockets from Python to C++. This works very well if I don't use

Re: [protobuf] Send structure over network

2013-08-21 Thread Christopher Head
On Tue, 20 Aug 2013 04:26:41 -0700 (PDT) utkarsh deep utkarshdon1...@gmail.com wrote: I want to send the structure over a network and my computer is Little Endian and Host Computer is Big Endian . Suppose I want to send struct Contract_DESC CD; char CounterPartyBrokerId[5];

Re: [protobuf] How to encode nested Python Protobuf

2013-08-26 Thread Christopher Head
On Sat, 24 Aug 2013 21:47:39 -0700 (PDT) chrisg...@gmail.com wrote: response = rpc_pb2.Response() response.service_name = response.method_name = SendHeartbeatResult response.client_id = ALERT_SERVICE response.status_cd = rpc_pb2.OK response.response_proto =

Re: [protobuf] How to encode nested Python Protobuf

2013-08-27 Thread Christopher Head
On Mon, 26 Aug 2013 17:32:23 -0700 (PDT) chrisg...@gmail.com wrote: Thanks for taking the time to read/reply. GetHeartbeat2 is my original version which I included as well and the way I had thought it should probably work. This code is serializing to string on the inner buffer and then

Re: [protobuf] store large data into files using protobuf

2013-10-19 Thread Christopher Head
. -- Christopher Head signature.asc Description: PGP signature

Re: [protobuf] Import .proto file and generated Java classes from JAR

2014-03-14 Thread Christopher Head
library you use in your system: arrange for the .jar to be in your classpath, like you would do with any other library .jar, and then consume the appropriate classes in your own code, like you would with any other library. -- Christopher Head signature.asc Description: PGP signature