VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
protobuf_registry.h
浏览该文件的文档.
1/*
2 * Copyright (C) 2026 by Thun Lu. All rights reserved.
3 * Author: Thun Lu <thun.lu@zohomail.cn>
4 * Repo: https://github.com/thun-res/vlink
5 * _ __ __ _ __
6 * | | / / / / (_) ____ / /__
7 * | | / / / / / / / __ \ / //_/
8 * | |/ / / /___ / / / / / / / ,<
9 * |___/ /_____/ /_/ /_/ /_/ /_/|_|
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
14 *
15 * http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
22 */
23
24/**
25 * @file protobuf_registry.h
26 * @brief Protobuf runtime include wrapper for schema-plugin support.
27 *
28 * @details
29 * Protobuf does not need a custom VLink-side registry implementation because
30 * generated message descriptors are already exposed through
31 * @c google::protobuf::DescriptorPool::generated_pool().
32 *
33 * This header only centralizes the protobuf runtime includes and the feature
34 * macro used by schema-plugin related code:
35 * - @c VLINK_HAS_SCHEMA_PLUGIN_PROTOBUF is defined when the required protobuf
36 * reflection headers are available in the current build environment.
37 *
38 * Keeping this probe in a dedicated header makes @c schema_plugin_base.h and
39 * other schema-plugin code easier to read and keeps protobuf availability
40 * checks consistent across the codebase.
41 */
42
43#pragma once
44
45/**
46 * @brief Enables protobuf-backed schema-plugin code when protobuf reflection is available.
47 */
48#if __has_include(<google/protobuf/dynamic_message.h>)
49#include <google/protobuf/descriptor.h>
50#include <google/protobuf/descriptor.pb.h>
51#include <google/protobuf/dynamic_message.h>
52#include <google/protobuf/message.h>
53#define VLINK_HAS_SCHEMA_PLUGIN_PROTOBUF
54#endif