protocol-buffers

Serialize hashtable using Protocol Buffers (.NET)

僤鯓⒐⒋嵵緔 提交于 2019-12-11 08:22:27
问题 I am trying to serialize/deserialize my custom class which contains hashtable property using protobuf-net v2. [ProtoContract] public class MyClass { [ProtoMember(1)] public Hashtable MyHashTable { get; set; } } When I call Serializer.Serialize(...) exception appears: No serializer defined for type: System.Collections.Hashtable I try to modify: [ProtoContract] public class MyClass { [ProtoMember(1, DynamicType = true)] public Hashtable MyHashTable { get; set; } } But I have another exception:

In protobuf-c, can optional uint32 variable have value 0

笑着哭i 提交于 2019-12-11 08:06:34
问题 Message Data{ optional uint64 userid = 1; repeated string usernames = 2; optional uint32 status = 3; } Case 1 - 'status' contains non-zero value' If status = non-zero value When I use the data__pack(const Data * message ,uint8_t * out) function to pack the data, the length of 'out' is 100, and the function returns 100 (The value 100 is used as an example). Case 2 - 'status' contains value 0 If status = 0 (for same values of userid and username as in Case 1) When I use the data__pack()

Linux g++ compiling error: /usr/bin/ld: cannot find -l/usr/local/include

你。 提交于 2019-12-11 07:57:10
问题 I am working on a project in which protobuf and zmq are involved. I have finished it on VS2010 and now want to make it work under Linux. I just installed protobuf and zmq on our Linux server and the Makefile looks like this: g++ -c -D_DEBUG TestTDFAPI_v2.cpp -I ../ g++ -c -D_DEBUG Platform.cpp g++ -c -D_DEBUG PathHelper.cpp g++ -c -D_DEBUG MyStruct.pb.cpp g++ -c -D_DEBUG MyStruct.cpp g++ -o Test_TDFAPI_v2 Platform.o PathHelper.o MyStruct.pb.o MyStruct.o TestTDFAPI_v2.o -l /usr/local/include

Using Python, how do I get a binary serialization of my Google protobuf message?

故事扮演 提交于 2019-12-11 07:38:56
问题 I see the function SerializeAsString in the protobuf Python documentation, but like this suggests, this gives me a string version of the binary data. Is there a way of serializing and parsing a binary array of protobuf data using Python? We have a C++ application that stores the protobuf messages as binary data in a file. We'd like to read and write to the file using Python. 回答1: Python strings can hold binary data, therefore SerializeAsString returns binary data. 回答2: I think that strings

How to define response headers for unary rpc

做~自己de王妃 提交于 2019-12-11 07:36:42
问题 In Go, I want to set some response headers from inside my rpc handler implementation. Specifically, I want to set some headers related to cache control. However, when the rpc is defined as unary response, the method signature generated by protoc only includes the request context and request message. This is in contrast to the code generated from a streaming response, which includes the request message and a grpc.ServerStream . Here's an example interface generated by protoc: type CmsServer

#import <string> in ios? Protobuf c++ in ios

元气小坏坏 提交于 2019-12-11 06:49:38
问题 I am trying to get protobuf into xcode 4 and work with ios 5. I've done other tutorials none have worked. I have used a script to compile the libraries into arm 7 architecture and then added them to my project. This is the only thing that has worked so far. My issue now is that I am trying to use the c++ generated files; however, I am getting an error saying #include -> lexical or preprocessor issue. Any tips? It only showed this when I tried to run my project on the ipad. Before, it was fine

Where is protoc and how do i install it?

纵饮孤独 提交于 2019-12-11 06:18:13
问题 I'd like to use the protoc command to generate java files I've been following the instructions in the README from github https://github.com/protocolbuffers/protobuf but it just tells you to download the zip file and that the "binary" is already included. However, after downloading the latest (and a couple other versions) and unzipping the files, I can't find the "protoc" binary. Is there some other missing instruction that i'm supposed to follow? P.S. i'm using Mac OS X 回答1: Open https:/

C++ equivalent to SerializeWithLengthPrefix

孤街浪徒 提交于 2019-12-11 06:12:56
问题 I built a communication library using Protocol Buffers (protobuf-net) using Sockets (TcpListener and TcpClient) and it is working fine, but now a co-worker needs to write a library to communicate with my software using C++. Turns out that I'm using the Serializer.NonGeneric.SerializeWithLengthPrefix and Serializer.NonGeneric.TryDeserializeWithLengthPrefix . Are there equivalent functions in the protobuf C++ libraries? If not, anyone knows how to implement it, or have it implemented to share?

How can I include an arbitrary set of Protobuf-built files without knowing their names?

纵饮孤独 提交于 2019-12-11 05:59:13
问题 I'm planning on using the rust-protobuf library. I've written a bash script that builds everything (including my code) and builds the .proto files I have into .rs files. The way the documentation tells me to proceed is to specifically just do: mod foo; for each of the .rs files generated. I'm hoping that my users can just drop in new .proto files into a directory, run the build script, and my code will take care of including all of the Rust implementations of the compiled .proto files. I know

Android application crashes because of protobuf

与世无争的帅哥 提交于 2019-12-11 05:45:22
问题 I have an Android application implemented with help of cocos2d-x engine. I linked protobuf library to the project and trying to SerializeToStrint() one proto-object: ProtoMessage message; message.set_app_id(1111); message.set_hardware_id("test string"); std::string str; message.SerializeToString(&str); That's builds fine, but when I trying to start application logcat send me next log: 09-14 10:26:51.748 13009 13009 I DEBUG : Build fingerprint: verizon/droid2we_vzw/cdma_droid2we:2.3.4/4.5.1_57