Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Alibaba MNN Protobuf API PB H

From Leeroopedia


Knowledge Sources
Domains Serialization, Type_System
Last Updated 2026-02-10 12:00 GMT

Overview

Generated C++ header for the Protocol Buffers Api, Method, and Mixin descriptor types used to describe service APIs.

Description

This header declares the google::protobuf::Api, google::protobuf::Method, and google::protobuf::Mixin classes, which represent structured API descriptions within the protobuf type system. These types are part of the well-known protobuf types and describe service interfaces, their methods, and mixin compositions. MNN vendors this file as part of the complete protobuf runtime needed for parsing TensorFlow and Caffe model files, where the full descriptor infrastructure is required for schema resolution.

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/api.pb.h
  • Lines: 1-1448

Signature

namespace google {
namespace protobuf {
class Api final : public ::PROTOBUF_NAMESPACE_ID::Message { ... };
class Method final : public ::PROTOBUF_NAMESPACE_ID::Message { ... };
class Mixin final : public ::PROTOBUF_NAMESPACE_ID::Message { ... };
}  // namespace protobuf
}  // namespace google

Import

#include "3rd_party/protobuf/src/google/protobuf/api.pb.h"

I/O Contract

Inputs

Name Type Required Description
N/A N/A N/A Header-only declarations; provides Api, Method, and Mixin message types

Outputs

Name Type Description
Api class google::protobuf::Api Describes a protobuf service API with name, methods, options, and version
Method class google::protobuf::Method Describes a single method within an API including request/response types
Mixin class google::protobuf::Mixin Describes API composition via mixin references

Usage Examples

// MNN internal usage
#include "google/protobuf/api.pb.h"
google::protobuf::Api api;
api.set_name("ModelService");
auto* method = api.add_methods();
method->set_name("Predict");

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment