如何在 protobuf-c 中序列化/反序列化枚举
我有以下带有枚举的消息:
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 执行此操作的示例将非常有帮助。谢谢!
I have the following message with an enumeration:
message testmessage {
enum testenum {
alpha = 1;
beta = 2;
}
required unit32 datapoint = 1;
required uint32 location = 2;
required int32 displacement = 3;
}
I know how to serialize/pack and deserialize/unpack the normal required fields but not the enum. There doesn't seem to be any example of this on the protobuf-c website http://code.google.com/p/protobuf-c/ An example of how to do this with c would be very helpful. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档 http://code.google.com/intl /sv/apis/protocolbuffers/docs/overview.html 您可能必须实际使用枚举。
尝试添加:
下方
并交叉手指
According to the documentation http://code.google.com/intl/sv/apis/protocolbuffers/docs/overview.html you would probably have to actually use the enum.
Try adding:
below
and cross yoyr fingers