protocol-buffers

Splitting protocol buffer definitions into multiple .proto files

可紊 提交于 2019-12-18 13:54:14
问题 I would like to include a protocol definition file in another protocol file. For example: // base.proto: message P_EndPoint { required int32 id = 1; required string host = 2; required int32 port = 3; } Then in another file: communication.proto: // somehow include `base.proto' // ... message P_CommunicationProtocol { required CP_MessageType type = 1; optional int32 id = 2; optional P_EndPoint identity = 3; repeated P_EndPoint others = 4; } // ... (Note: developers.google.com is not available

Error when parsing graph_def from string

江枫思渺然 提交于 2019-12-18 13:32:24
问题 I am trying to run a very simple saving of a Tensorflow graph as .pb file, but I have this error when parsing it back: Traceback (most recent call last): File "test_import_stripped_bm.py", line 28, in <module> graph_def.ParseFromString(fileContent) File "/usr/local/lib/python3.5/dist-packages/google/protobuf/message.py", line 185, in ParseFromString self.MergeFromString(serialized) File "/usr/local/lib/python3.5/dist-packages/google/protobuf/internal/python_message.py", line 1069, in

Conflict Protobuf version when using Opencv and Tensorflow c++

空扰寡人 提交于 2019-12-18 13:13:00
问题 I am currently trying to use Tensorflow's shared library in a non-bazel project, so I creat a .so file from tensorflow using bazel. but when I launch a c++ program that uses both Opencv and Tensorflow, it makes me the following error : [libprotobuf FATAL external/protobuf/src/google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.1.0). Contact the program author for an

Combining Google proto buffers with Jersey/JAX-RS

醉酒当歌 提交于 2019-12-18 12:57:08
问题 Currently I have a RESTful web service with endpoints that are exposed via Jersey/JAX-RS: @Path("/widgets") public class WidgetResource { @GET List<Widget> getAllWidgets() { // gets Widgets somehow } @POST Widget save(Widget w) { // Save widget and return it } } I use Jackson for serializing/deserializing my POJOs into JSON, and my service both responds to and sends back my POJOs as application/json . I am now looking to possibly use Google protocol buffers (or an equivalent technology) to

How can I send multiple types of objects across Protobuf?

喜你入骨 提交于 2019-12-18 12:30:23
问题 I'm implementing a client-server application, and am looking into various ways to serialize and transmit data. I began working with Xml Serializers, which worked rather well, but generate data slowly, and make large objects, especially when they need to be sent over the net. So I started looking into Protobuf, and protobuf-net. My problem lies in the fact that protobuf doesn't sent type information with it. With Xml Serializers, I was able to build a wrapper which would send and receive any

How can I send multiple types of objects across Protobuf?

寵の児 提交于 2019-12-18 12:30:22
问题 I'm implementing a client-server application, and am looking into various ways to serialize and transmit data. I began working with Xml Serializers, which worked rather well, but generate data slowly, and make large objects, especially when they need to be sent over the net. So I started looking into Protobuf, and protobuf-net. My problem lies in the fact that protobuf doesn't sent type information with it. With Xml Serializers, I was able to build a wrapper which would send and receive any

In Protocol Buffers, how to import a file from the upper level directory?

删除回忆录丶 提交于 2019-12-18 11:53:49
问题 I have the following code in a protocol buffer file(pcfg_lm.proto): import "../types/language.proto"; package nlp; message PCFGProto { required Language lang = 1; } And of course there is a proto file exists at ../types/language.proto. However, when I issue the command: protoc pcfg_lm.proto --cpp_out=/tmp Here is the error message: ../types/language.proto: File not found. pcfg_lm.proto: Import "../types/language.proto" was not found or had errors. pcfg_lm.proto:6:12: "Language" is not defined

Installing Google Protocol Buffers on mac

别来无恙 提交于 2019-12-18 09:54:11
问题 I would like to install the older version of Google Protocol Buffers (protobuf-2.4.1) on mac using Terminal command line. I tried with brew install protobuf , but the latest version 2.5.0 has been installed. Is it possible to install the older version from terminal. Thanks 回答1: There are some issues with building protobuf 2.4.1 from source on a Mac. There is a patch that also has to be applied. All this is contained within the homebrew protobuf241 formula, so I would advise using it. To

Protobuf-net fails to serialize property with only getter - Cannot apply changes to property

流过昼夜 提交于 2019-12-18 06:38:32
问题 I am using protobuf-net to serialize an object and I get exception: Cannot apply changes to property TestProject.TestMessage.ClientId with stacktrace: at ProtoBuf.Serializers.PropertyDecorator.SanityCheck(TypeModel model, PropertyInfo property, IProtoSerializer tail, Boolean& writeValue, Boolean nonPublic, Boolean allowInternal) at ProtoBuf.Serializers.PropertyDecorator..ctor(TypeModel model, Type forType, PropertyInfo property, IProtoSerializer tail) at ProtoBuf.Meta.ValueMember

Protobuf-net fails to serialize property with only getter - Cannot apply changes to property

梦想与她 提交于 2019-12-18 06:37:31
问题 I am using protobuf-net to serialize an object and I get exception: Cannot apply changes to property TestProject.TestMessage.ClientId with stacktrace: at ProtoBuf.Serializers.PropertyDecorator.SanityCheck(TypeModel model, PropertyInfo property, IProtoSerializer tail, Boolean& writeValue, Boolean nonPublic, Boolean allowInternal) at ProtoBuf.Serializers.PropertyDecorator..ctor(TypeModel model, Type forType, PropertyInfo property, IProtoSerializer tail) at ProtoBuf.Meta.ValueMember