Flatbuffer serialization for scalar fields

42 views
Skip to first unread message

Gaurav Jain

unread,
Apr 25, 2016, 12:37:37 AM4/25/16
to FlatBuffers

Does absent fields also occupies space in serialise Flatbuffer object ? If not, then how does mutation for scalar entries work ? I can understand the mutation of non-scalar entries where we need to relocate older Flatbuffer content to new memory location.

Wouter van Oortmerssen

unread,
Apr 25, 2016, 12:27:36 PM4/25/16
to Gaurav Jain, FlatBuffers
No, absent fields do not occupy space. That indeed means that by default, mutation functions fail (notice they return a bool), if you try to set a field that is not present.

If you intend to use a buffer with mutation, it may be worth to construct it using `force_defaults` such that all scalars are present.

On Sun, Apr 24, 2016 at 9:37 PM, Gaurav Jain <gaurav03...@gmail.com> wrote:

Does absent fields also occupies space in serialise Flatbuffer object ? If not, then how does mutation for scalar entries work ? I can understand the mutation of non-scalar entries where we need to relocate older Flatbuffer content to new memory location.

--
You received this message because you are subscribed to the Google Groups "FlatBuffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flatbuffers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages