Implementation:Alibaba MNN Protobuf Descriptor PB H
| Knowledge Sources | |
|---|---|
| Domains | Serialization, Reflection |
| Last Updated | 2026-02-10 12:00 GMT |
Overview
Generated C++ header for descriptor.proto, the self-describing protobuf schema that defines the structure of all .proto files.
Description
This is the largest generated header in the protobuf runtime, containing the C++ message classes for every element of the protobuf schema language itself: FileDescriptorProto, DescriptorProto, FieldDescriptorProto, EnumDescriptorProto, ServiceDescriptorProto, FileOptions, MessageOptions, and many more. These self-describing types allow protobuf to represent its own schemas as serialized messages, enabling features like dynamic message creation and schema evolution. MNN vendors this header because TensorFlow and Caffe model parsers rely on the descriptor proto infrastructure to load and interpret model file schemas at runtime.
Usage
Vendored dependency used internally by MNN for parsing protobuf-based model formats (TensorFlow, Caffe). Not directly imported by end users.
Code Reference
Source Location
- Repository: Alibaba_MNN
- File:
3rd_party/protobuf/src/google/protobuf/descriptor.pb.h - Lines: 1-14766
Signature
namespace google {
namespace protobuf {
class FileDescriptorProto final : public Message { ... };
class DescriptorProto final : public Message { ... };
class FieldDescriptorProto final : public Message { ... };
class EnumDescriptorProto final : public Message { ... };
class FileOptions final : public Message { ... };
} // namespace protobuf
} // namespace google
Import
#include "3rd_party/protobuf/src/google/protobuf/descriptor.pb.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| N/A | N/A | N/A | Header-only declarations; defines the proto message types for schema self-description |
Outputs
| Name | Type | Description |
|---|---|---|
| FileDescriptorProto | google::protobuf::FileDescriptorProto |
Serializable representation of a complete .proto file |
| DescriptorProto | google::protobuf::DescriptorProto |
Serializable representation of a message type definition |
| FieldDescriptorProto | google::protobuf::FieldDescriptorProto |
Serializable representation of a single field definition |
Usage Examples
// MNN internal usage
google::protobuf::FileDescriptorProto file_proto;
file_proto.set_name("model.proto");
auto* msg = file_proto.add_message_type();
msg->set_name("LayerParameter");
pool->BuildFile(file_proto);