I cannot figure out, how I am able to read the vector of union from the buffer again:
// read
structure_Structure_table_t structure = structure_Structure_as_root(buf);
// is this the correct type?
structure_Layer_vec_t layers = structure_Structure_layers(structure);
size_t layers_len = structure_Layer_vec_len(layers);
for(int i = 0; i < layers_len; i++) {
// is this the correct type?
const structure_Layer_union_type_t ith_layer = structure_Layer_vec_at(layers, i);
// is always false?
if(ith_layer == structure_Layer_Domain) {
// not sure how to parse or access the layer/ lines of code field?
} else {
printf("else");
}
}
// -> leads to segmentation error
Does anyone have a similar problem or any ideas how to solve this?
EDIT:
I am sorry, this is my fault. I found the test that covers union vectors as described in the README and was able to solve my problem:
Hello, I am trying to use a vector of union in my flatbuffers' schema, but unfortunately, there is no documentation how this could be achieved.
Currently I am using the following code to write into the buffer, which seems to be fine (Am I already wrong here?).
I cannot figure out, how I am able to read the vector of union from the buffer again:
Does anyone have a similar problem or any ideas how to solve this?
EDIT:
I am sorry, this is my fault. I found the test that covers union vectors as described in the README and was able to solve my problem: