是否可以反序列化表示非根表的二进制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二进制文件
发布评论