反序列化表示非根表的FlatBuffers二进制文件

编程入门 行业动态 更新时间:2024-10-25 02:28:50
本文介绍了反序列化表示非根表的FlatBuffers二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否可以反序列化表示非根表的二进制Flatbuffers对象?

Is it possible to deserialize a binary flatbuffers object that represents a non-root table?

假设以下平面缓冲区架构:

Suppose the following flatbuffers schema:

table Foo { ... } table Bar { value:[Foo]; } root_type Bar;

假设我们可以访问表示Foo对象的二进制数据.是否可以将此二进制文件反序列化为类Foo的对象?查看我的c ++生成的头文件,看不到任何生成的函数,例如GetFoo().

Suppose we have access to the binary data that represents the Foo object. Is it possible to deserialize this binary to an object of class Foo? Looking at my c++ generated header file, I do not see any generated function like GetFoo().

推荐答案

GetFoo只是调用GetRoot<Foo>的已声明root_type的便捷功能,您可以使用GetRoot<Bar>来访问任何类型的根目录,假设缓冲区是这样构造的.

GetFoo is just a convenience function for the declared root_type that calls GetRoot<Foo>, you can use GetRoot<Bar> to access any type as the root, assuming the buffer was constructed as such.

更多推荐

反序列化表示非根表的FlatBuffers二进制文件

本文发布于:2023-11-05 08:36:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560377.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:二进制文件   序列化   非根表   FlatBuffers

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!