mzaks / FlatBuffersSwift

This project brings FlatBuffers (an efficient cross platform serialization library) to Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement test with multiple different root tables

hassila opened this issue · comments

Would be good to verify, should be possible: [(http://stackoverflow.com/questions/35937976/multiple-root-tables-in-flatbuffers)]

IIUC, we should codegen

    public static func fromByteArray(data : UnsafeBufferPointer<UInt8>, config : BinaryReadConfig = BinaryReadConfig()) -> T
    public static func fromRawMemory(data : UnsafeMutablePointer<UInt8>, count : Int, config : BinaryReadConfig = BinaryReadConfig()) -> T

for all tables, not only the declared root one?

I am not sure it is a good idea because it interferes with file_identifier I guess #48 is a better solution where you can specify different root_type corresponding to different file_identifier

#48 solves a slightly different problem - the ability to merge multiple schemas - this case was about being able to decode i.e. FoobarContainer or Foobar with the classes that were in this case in the same file.

The use case is e..g. when you get multiple different messages sent to you over a network connection, it works to define each in a separate .fbs, but perhaps a bit cumbersome. I could live with #48 though.