Apollo 技术文档Apollo 技术文档
指南
  • 架构概述
  • BigWorld 架构深度解析
  • BigWorld 进程架构与玩家生命周期
  • AOI九宫格系统详解
  • AOI广播与消息去重
  • Base 模块
  • Core 模块
  • Runtime 模块
  • Data 模块
  • Network 模块
  • /modules/actor.html
  • Game 模块
  • BigWorld 模块
服务器应用
API 参考
QA
GitHub
指南
  • 架构概述
  • BigWorld 架构深度解析
  • BigWorld 进程架构与玩家生命周期
  • AOI九宫格系统详解
  • AOI广播与消息去重
  • Base 模块
  • Core 模块
  • Runtime 模块
  • Data 模块
  • Network 模块
  • /modules/actor.html
  • Game 模块
  • BigWorld 模块
服务器应用
API 参考
QA
GitHub
  • API 参考
  • Base API
  • Core API
  • Runtime API

API 参考

本节包含 Apollo 的 API 参考文档。

模块 API

  • Base API - 基础工具类 API
  • Core API - 核心框架 API
  • Runtime API - 运行时 API
  • Network API - 网络通信 API
  • Data API - 数据访问 API
  • Game API - 游戏逻辑 API

命名空间

所有 Apollo API 都在 apollo 命名空间下:

#include <apollo/base/time.hpp>
#include <apollo/core/log.hpp>
#include <apollo/net/tcp/server.hpp>

using apollo::base::Time;
using apollo::core::LogManager;
using apollo::net::tcp::Server;

错误处理

Apollo 使用异常和错误码两种方式报告错误:

// 异常方式
try {
    auto result = someOperation();
} catch (const apollo::Exception& e) {
    LOG_ERROR("App", "错误: {}", e.what());
}

// 错误码方式
auto result = someOperation();
if (!result.ok()) {
    LOG_ERROR("App", "错误: {}", result.error());
}

线程安全

Apollo 的 API 线程安全性分为三级:

  • ✅ 线程安全 - 可以在多线程中安全调用
  • ⚠️ 条件安全 - 需要外部同步
  • ❌ 不安全 - 必须在同一线程调用

文档中会标注每个 API 的线程安全级别。

在 GitHub 上编辑此页
最后更新: 3/20/26, 6:06 AM
贡献者: cuihairu
Next
Base API