Implementation:Alibaba MNN FlatBuffers Reflection Generated
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Code_Generation |
| Last Updated | 2026-02-10 12:00 GMT |
Overview
Auto-generated C++ accessors for the FlatBuffers reflection schema, enabling runtime introspection of binary schemas.
Description
reflection_generated.h is a machine-generated header produced by flatc from the reflection schema (reflection.fbs). It defines zero-copy accessor classes for every element of the reflection schema: Schema, Object, Field, Enum, EnumVal, Type, and Service. These accessors allow code to inspect the structure of any FlatBuffers binary schema at runtime.
Usage
Vendored dependency used internally by MNN for model serialization. Not directly imported by end users.
Code Reference
Source Location
- Repository: Alibaba_MNN
- File:
3rd_party/flatbuffers/include/flatbuffers/reflection_generated.h - Lines: 1-1182
Signature
namespace reflection {
struct Schema;
struct Object;
struct Field;
struct Enum;
struct EnumVal;
const Schema *GetSchema(const void *buf);
}
Import
#include "flatbuffers/reflection_generated.h"
I/O Contract
| Input | Output |
|---|---|
Binary schema buffer (.bfbs) |
reflection::Schema root with typed accessors for all schema elements
|
Usage Examples
#include "flatbuffers/reflection_generated.h"
auto schema = reflection::GetSchema(bfbs_data);
auto root = schema->root_table();
for (auto field : *root->fields()) {
auto name = field->name()->str();
auto type = field->type()->base_type();
}
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment