Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deserialize flatbuffers binary that represents non-root table

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;

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().

like image 700
Pejman Avatar asked Sep 17 '25 01:09

Pejman


1 Answers

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.

like image 125
Aardappel Avatar answered Sep 19 '25 14:09

Aardappel