Implementation:Alibaba MNN FlatBuffers Base Header
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Platform_Abstraction |
| Last Updated | 2026-02-10 12:00 GMT |
Overview
Foundational header providing platform detection, endianness handling, and basic type definitions for the FlatBuffers library.
Description
base.h is the lowest-level header in the vendored FlatBuffers library. It detects the target platform and compiler, defines endianness conversion macros, and establishes fundamental types (such as uoffset_t, soffset_t, and voffset_t) used throughout the serialization framework. All other FlatBuffers headers depend on this file.
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/base.h - Lines: 1-331
Signature
typedef uint32_t uoffset_t;
typedef int32_t soffset_t;
typedef uint16_t voffset_t;
template<typename T> T EndianSwap(T t);
#define FLATBUFFERS_LITTLEENDIAN 1
Import
#include "flatbuffers/base.h"
I/O Contract
| Input | Output |
|---|---|
| Compiler/platform preprocessor defines | Normalized type aliases, endianness macros, and static assertions |
Usage Examples
#include "flatbuffers/base.h"
// Use fundamental offset types
flatbuffers::uoffset_t offset = 0;
flatbuffers::voffset_t field_offset = 4;
// Endian conversion
uint32_t val = flatbuffers::EndianSwap(0x01020304);
Related Pages
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment