gpt4 book ai didi

c - 如何序列化/反序列化 protobuf-c 中的枚举

转载 作者:太空宇宙 更新时间:2023-11-04 04:56:44 26 4
gpt4 key购买 nike

我有以下带有枚举的消息:

message testmessage {

enum testenum {
alpha = 1;
beta = 2;

}

required unit32 datapoint = 1;
required uint32 location = 2;
required int32 displacement = 3;

}

我知道如何序列化/打包和反序列化/解包正常的必填字段,但不知道枚举。 protobuf-c 网站上似乎没有这方面的任何示例 http://code.google.com/p/protobuf-c/如何使用 c 执行此操作的示例将非常有帮助。谢谢!

最佳答案

根据文档http://code.google.com/intl/sv/apis/protocolbuffers/docs/overview.html您可能必须实际使用枚举。

尝试添加:

 optional testenum enumerated = 4; 

下面

 required int32  displacement = 3;

交叉你的手指

关于c - 如何序列化/反序列化 protobuf-c 中的枚举,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6472692/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com