Deserialize flatbuffers binary that represents non-root table

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



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


Foo


Foo


GetFoo()




1 Answer
1



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.


GetFoo


root_type


GetRoot<Foo>


GetRoot<Bar>





Oh, this is embarrassing. Thank you so much. Your answer prompted me to look at the documentation once again and find this comment right in the tutorial: "GetMonster is a convenience function that calls GetRoot<Monster>, the latter is also available for non-root types."
– Pejman
Aug 12 at 15:51


GetMonster


GetRoot<Monster>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered