Questions tagged [flatbuffers]

FlatBuffers is a serialization library by Google. It is particularly suitable for games and other memory-constrained applications.

FlatBuffers is a serialization library by Google.

Rather than unpacking the data, it allows the user to directly access the serialized data, thus reducing the memory requirements. For that reason, it is particularly suitable for games and other memory constrained applications.

384 questions
1
vote
1 answer

How to use Flatbuffers with JavaScript in the browser?

Pure JavaScript support for Flatbuffers has been abandoned, and the project website tells you to use transpile from TypeScript. This is what I tried: Write a Flatbuffers file website.fbs. Run flatc --ts website.fbs to receive website.ts. Run tsc…
user16836139
1
vote
0 answers

May I add a GetMutableSizePrefixedRoot (or GetSizePrefixedMutableRoot)?

We are using flatbuffers with size prefixed buffers and want to mutate a flatbuffer but there is no GetMutableSizePrefixedRoot or GetSizePrefixedMutableRoot. I could make a PR and add one like that. template T…
Stefan F.
  • 43
  • 3
1
vote
1 answer

When converting flatbuffers object to JSON, how to deal with binary data?

Let's say I have an fbs scheme like this one: table SomeItem { module_version:string; message_id:[uint8]; some_other_id:[uint8]; event_time_us:uint64; message:string; } It's an example, the real structure is much, much bigger.…
Nikita128
  • 150
  • 2
  • 16
1
vote
1 answer

`...ByKey()` returns null in Kotlin flatbuffers impl

I have the following schema: ... table FiltersByDomain { domain: string (key); filters: [FilterIsIncluded] (required); } table Index { ... filters_by_domain: [FiltersByDomain]; ... } root_type Index; When i use the getter by index and…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
1
vote
1 answer

How to adapt flatbuffers `table` to be used with `Cow` in `Rust`?

I have some hierarchy of traits and i need to adapt both structs and flatbuffers table to be used via the trait as follows: // trait pub trait TFilter : Clone { fn get_text(&self) -> &str; } // structure #[derive(Clone)] pub struct…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
1
vote
1 answer

Vector of tables, flatbuffers C

I'm experimenting with flatbuffers, in C, just getting a feel for it. I'm having a weird issue. Well, a couple more than likely. I think I'm building the flatbuffers and adding all the correct components in the correct manner. However, when I try to…
Vadtec
  • 11
  • 4
1
vote
1 answer

What's the common API for both `Vec` and flatbuffers' vector of String in Rust?

I'd like to be able to iterate over Rust vector of String (Vec) and flatbuffers' vector of strings: IDL as follows: table Sitekeys { domains: [string]; } Here is how the file is generated (with flatc --rust ...): #[inline] pub fn…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
1
vote
1 answer

Opinions on using Flatbuffer in REST

I was wondering what the general opinion was about using different serialization methods for REST APIs. JSON and XML are the most popular but I was wondering if serialization in Flatbuffers might be a possible alternative. Deserialization on the…
ddibiase
  • 1,412
  • 1
  • 20
  • 44
1
vote
0 answers

FlatBuffers - Unable to get the prefixed size of buffer with Boost ASIO

I am using Boost ASIO and FlatBuffers. Here is how I send message: flatbuffers::FlatBufferBuilder builder; std::string str = "ABCDEFG"; auto name = builder.CreateString(str); auto accountRole =…
Venelin
  • 2,905
  • 7
  • 53
  • 117
1
vote
1 answer

Check if a FlexBuffers buffer is not corrupted in C++

I want to use FlexBuffers as a kind of binary format JSON. But since the buffer and its size may be given from an external user, I want to know if there's any way to check if a FlexBuffers buffer with its size is real and not corrupted in C++.
Willy
  • 581
  • 2
  • 10
1
vote
0 answers

socket in dart can not get response from server

I used client in dart and server in java netty to send an object with flatbuffer protocol , the problem is server can get data but when server send data to client dart then nothing happen in socket listen dart code : Future main() async { …
Longbee
  • 11
  • 1
1
vote
0 answers

Serialize vector of struct for flatbuffer in Java

I am looking for an example of using vector of struct in flatbuffer in java. I tried looking at tutorial and https://github.com/google/flatbuffers/blob/master/samples/SampleBinary.java But so far have not found any good example. In tutorial…
shanker861
  • 619
  • 1
  • 5
  • 9
1
vote
0 answers

gRPC with flatbuffers applicability on low resource platform and serial channel

We've tried to evaluate gRPC with flatbuffers on an embedded linux system, the resulting executable is ~6 MB for a very basic example with protobuf. We are looking to strip off as much as possible to move to platforms with even less resources. Only…
t1--
  • 11
  • 2
1
vote
1 answer

Generate flatbuffers windows shared lib with CMake

I am trying to generate Windows shared lib (dll) of Google flatbuffers (https://github.com/google/flatbuffers) using CMake. I have used the following cmake command, but it always generates a static library (*.lib) when I build it. cmake .. -G…
ontherocks
  • 1,747
  • 5
  • 26
  • 43
1
vote
2 answers

Is FlatBuffers C++ reinterpret_cast access actually undefined behavior? Is it practically OK to do that?

Recently I try to use FlatBuffers in C++. I found FlatBuffers seems to use a lot of type punning with things like reinterpret_cast in C++. This make me a little uncomfortable because I've learned it's undefined behavior in many cases. e.g. Rect in…
Willy
  • 581
  • 2
  • 10