protocol-buffers

Undefined reference while linking static C library

故事扮演 提交于 2019-12-13 18:28:06
问题 In my latest project I am encountering a strange issue regarding an undefined reference to a method of a shared library. I searched on SO but all I could find was either C++ related (extern "C") or not really helping. The library in question is my fork of libosm which uses protobuf to generate de-/serialization code for OpenStreetMap data in its binary format (.osm.pbf). The function in question is osmpbf__blob__unpack but that is just the first I end up using so I suspect its a general

How does JsonFormat.printer().print() work?

喜夏-厌秋 提交于 2019-12-13 17:11:59
问题 I have a very simple proto: message ChargeCardResponse { bool success = 1; } When I'm trying to parse it to String I get a very strange output from the JsonFormat.printer().print() which depends on the success value. ChargeCardResponse.Builder builder = ChargeCardResponse.newBuilder(); System.out.println(JsonFormat.printer().print(builder.setSuccess(true).build())); Output: { "success": true } ChargeCardResponse.Builder builder2 = ChargeCardResponse.newBuilder(); System.out.println(JsonFormat

protobuf-net concurrent performance issue in TakeLock

旧巷老猫 提交于 2019-12-13 16:57:30
问题 We're using protobuf-net for sending log messages between services. When profiling stress testing, under high concurrency, we see very high CPU usage and that TakeLock in RuntimeTypeModel is the culprit. The hot call stack looks something like: *Our code...* ProtoBuf.Serializer.SerializeWithLengthPrefix(class System.IO.Stream,!!0,valuetype ProtoBuf.PrefixStyle) ProtoBuf.Serializer.SerializeWithLengthPrefix(class System.IO.Stream,!!0,valuetype ProtoBuf.PrefixStyle,int32) ProtoBuf.Meta

Reading comments from .proto files using a Protocol Buffers descriptor object

亡梦爱人 提交于 2019-12-13 13:15:39
问题 I am currently revisiting a project using Google Protocol Buffers. In the project I want to make use of the features Descriptors and Reflection of Protocol Buffers. The official documentation states that the comments of .proto files can be read: With the function DebugStringWithOptions(), called on a message or descriptor. With the function GetSourceLocation(), called on a descriptor. I am unable to retrieve comments, so I think I am doing something completely wrong or that feature isn't

error while loading shared libraries: libcapnp-0.5.3.so

淺唱寂寞╮ 提交于 2019-12-13 07:52:51
问题 I think this is a generic problem not specifically related to Cap'n Proto. My project's build succeeds but on run I get: error while loading shared libraries: libcapnp-0.5.3.so: cannot open shared object file: No such file or directory Maybe I am missing something in CMake? set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lcapnp -lkj") I verified libcapnp-0.5.3.so exists in /usr/local/lib I also tried adding: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L/usr/local/lib/libcapnp-0.5.3.so") 回答1: /usr/local

converting array of binary doubles in protocol buffer to javascript numbers

匆匆过客 提交于 2019-12-13 07:23:56
问题 I'm using protocol buffers over zeroMQ to send graph data from C++ to a Javascript frontend: message RawData { Type type = 1; bytes data = 2; } when i call RawData.getData() i get something like this (usually much longer): Data: 0, 0, 0, 0, 0, 0, 0, 0, 64, 1, 118, 62, 112, 8, 12, 63 This is two 8 bytes numbers, where each index in the array is 1 byte. How do I convert this into double representation in Javascript? EDIT: i ended up changing the protocol buffer message to repeated double data =

Google Protocol Buffers, backward reposition IO head in the stream objects provided

痴心易碎 提交于 2019-12-13 04:18:27
问题 I want to move the IO head to the start of a certain CodedOutputStream or ZeroCopyOutputStream so I can update a header data structure with how many protobuf messages are in the file, and how many bytes the following messages consume. The Backup function is not intended for this, any suggestions ? I am creating a file format for event data, where each file contains multiple event data-sets. I need 2 types of header entities for this (fixed size)A global one, and a per data-set one. I update

Are there any applications currently offering a Protocol Buffers API?

橙三吉。 提交于 2019-12-13 03:59:09
问题 I recently stumbled upon Google's Protocol Buffers as a Kickstarter project I'm following, Lifx, plans to release an SDK utilizing Protocol Buffers as the interface. I was just wondering if anyone knows of any existing applications or services offering a Protocol Buffers API? I am just looking to get some experience playing around with it. 回答1: Protocol buffers is first and foremost a mechanism to serialize your program data into binary format (for storage or transfer over the network ) and

convert keras h5 to tensorflow pb for batch inference

穿精又带淫゛_ 提交于 2019-12-13 03:46:48
问题 I have a problem with making batch inference using a tensorflow protobuf graph exported from a keras h5 model. Eventhough the exported pb graph can accept multiple inputs (samples), it always gives a single output regardless of the number of inputs. Here is a simple example to demonstrate the problem. from keras.models import Model,load_model from keras.layers import Dense, Input from keras import backend as K import tensorflow as tf import numpy as np import os import os.path as osp pinput =

Send binary file from Java Server to C# Unity3d Client with Protocol Buffer

眉间皱痕 提交于 2019-12-13 03:44:29
问题 I have asked this question https://stackoverflow.com/questions/32735189/sending-files-from-java-server-to-unity3d-c-sharp-client but I saw that it isn't an optimal solution to send files between Java and C# via built-in operations, because I also need also other messages, not only the file content. Therefore, I tried using Protobuf, because it is fast and can serialize/deserialize objects platform independent. My .proto file is the following: message File{ optional int32 fileSize = 1;