protocol-buffers

Protocol Buffer Error on compile during GOOGLE_PROTOBUF_MIN_PROTOC_VERSION check

梦想与她 提交于 2019-11-30 23:52:46
问题 I'm currently getting an error which points me to these lines in the header file produced by protoc: #if 2006001 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION #error This file was generated by an older version of protoc which is #error incompatible with your Protocol Buffer headers. Please #error regenerate this file with a newer version of protoc. #endif But my protoc version matches the one above: protoc --version libprotoc 2.6.1 What am I doing wrong? Originally my protoc version was 3.0.0 then

Accessing field of Protobuf message of unknown type in Python

跟風遠走 提交于 2019-11-30 23:25:12
问题 Let's say I have 2 Protobuf-Messages, A and B. Their overall structure is similar, but not identical. So we moved the shared stuff out into a separate message we called Common. This works beautifully. However, I'm now facing the following problem: A special case exists where I have to process a serialized message, but I don't know whether it's a message of type A or type B. I have a working solution in C++ (shown below), but I failed to find a way to do the same thing in Python. Example: //

Define dictionary in protocol buffer

半腔热情 提交于 2019-11-30 21:55:51
I'm new to both protocol buffers and C++, so this may be a basic question, but I haven't had any luck finding answers. Basically, I want the functionality of a dictionary defined in my .proto file like an enum . I'm using the protocol buffer to send data, and I want to define units and their respective names. An enum would allow me to define the units, but I don't know how to map the human-readable strings to that. As an example of what I mean, the .proto file might look something like: message DataPack { // obviously not valid, but something like this dict UnitType { KmPerHour = "km/h";

Parse Google Protocol Buffers datagram without .proto file?

泪湿孤枕 提交于 2019-11-30 20:32:30
is it possible to parse an incoming google protocol buffers datagram without any .proto file? I merely now its been serialized using protocol buffers but have no idea about the IDL file. I'm looking for a way to just iterate through any value by some sort of reflection? Is this possible? Thank you! protoc --decode_raw < my_file You need to take the following things into account when inspecting the output: None of the field names are visible, just the tag numbers. All varint-fields are shown as integers. This is ok for most types, but sint* will appear in the "zigzagged" format. Doubles and

Restoring .proto file from descriptor string. Possible?

人盡茶涼 提交于 2019-11-30 19:49:32
问题 Is it possible to decompile a string containing Protocol Buffers descriptor back to .proto file? Say I have a long string like \n\file.proto\u001a\u000ccommon.proto\"\u00a3\u0001\n\nMsg1Request\u0012\u0017\n\u0006common\u0018\u0001 ... etc. I need to restore .proto, not necessary exactly as it was but compilable. 回答1: Yes it should be possible to get some thing close get original definition. I do not know of any existing code to do it (hopefully some one else will). Hava a look at how

Protocol buffer `ParseFromString` in Java for parsing text format?

走远了吗. 提交于 2019-11-30 19:09:14
Is ParseFromString available in Java for protocol buffers? The C++ version has it: here immibis Here is the implementation of ParseFromString (note that TextFormat::ParseFromString simply calls TextFormat::Parser::ParseFromString on a new Parser object): bool TextFormat::Parser::Parse(io::ZeroCopyInputStream* input, Message* output) { output->Clear(); return Merge(input, output); } bool TextFormat::Parser::ParseFromString(const string& input, Message* output) { io::ArrayInputStream input_stream(input.data(), input.size()); return Parse(&input_stream, output); } You can see that Parse simply

Wheel files : What is the meaning of “none-any” in protobuf-3.4.0-py2.py3-none-any.whl

依然范特西╮ 提交于 2019-11-30 18:51:04
I used pip to get .whl file for numpy pip wheel --wheel-dir=./ numpy and I have got numpy-1.13.3-cp27-cp27mu-linux_armv7l.whl because I am using ARM platform, but when run pip for protobuf pip wheel --wheel-dir=./ protobuf I got protobuf-3.4.0-py2.py3-none-any.whl So, why isn't linux_armv7l like the case of numpy, I didn't alter the machine and searched for that difference but no information. thanks for advice . Let's split package names by components: numpy — package name 1.13.3 — package version cp27 — the package was compiled to be used with this version of Python cp27mu — compilation flags

Google's Protocol Buffers in c#

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 17:43:42
We are looking at using Google's Protocol Buffers to handle serialization between a c++ application and a c# application via networking. My question is, I've found a couple of different verisions for c#. Both look pretty good, however, does anyone know what is different (if anything) between the two protobuf-net jskeet / dotnet-protobufs Sure; dotnet-protobufs is a port of the java version, so shares a very similar API and approach to the core google implementation; code-gem, immutability, etc. Protobuf-net is byte compatible, but is a complete from-scratch re-implementation, following

Define dictionary in protocol buffer

放肆的年华 提交于 2019-11-30 17:15:52
问题 I'm new to both protocol buffers and C++, so this may be a basic question, but I haven't had any luck finding answers. Basically, I want the functionality of a dictionary defined in my .proto file like an enum . I'm using the protocol buffer to send data, and I want to define units and their respective names. An enum would allow me to define the units, but I don't know how to map the human-readable strings to that. As an example of what I mean, the .proto file might look something like:

Python project using protocol buffers, Deployment issues

China☆狼群 提交于 2019-11-30 16:50:04
问题 I have a Python project that uses setuptools for deployment and I mostly followed this guide regarding project structure. The project uses Google Protocol Buffers to define a network message format. My main issue is how to make setup.py call the protoc-compiler during installation to build the definitions into a _pb2.py file. In this question the advice was given to just distribute the resulting _pb2.py files along with the project. While this might work for very similar platforms, I've found