ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
ngl::tprotocol Class Reference

模板化协议处理类,支持Lua绑定和协议映射。 More...

#include <tprotocol.h>

Classes

struct  info
 协议元数据信息结构体。 More...

Static Public Member Functions

static bool set_customs_index (int32_t acustoms)
 在注册块运行前设置下一个自定义协议ID基数。
template<typename ... ARGS>
static void tp_customs (int32_t aprotocolnum=-1, int32_t ahigh=0)
 注册一个或多个自定义C++协议。
template<typename ... ARGS>
static void tp_customs_script (int32_t aprotocolnum=-1, int32_t ahigh=0)
 注册一个或多个自定义协议并为其暴露脚本发送桥接。
template<typename T>
static bool init_protobufs ()
 从xmlprotocol元数据延迟解析protobuf支持的协议ID。
template<typename T>
static infoget ()
 解析C++类型的元数据块,如需要则延迟创建。
static infoget (const char *aname)
template<typename T, typename ... TAGES>
static bool set_hightvalue (int32_t ahightlevel)
template<typename T>
static i32_protocolnum protocol ()
static infoget (i32_protocolnum aprotocol)
static const char * name (i32_protocolnum aprotocol)
static std::optional< int32_t > highvalue (i32_protocolnum aprotocol)
static void allprotocol (std::map< i32_protocolnum, std::string > &amap)

Detailed Description

模板化协议处理类,支持Lua绑定和协议映射。

提供基于模板的协议处理函数注册、协议名称到处理函数的映射, 以及支持Lua脚本绑定的协议处理机制。

Member Function Documentation

◆ get()

template<typename T>
info * ngl::tprotocol::get ( )
inlinestatic

解析C++类型的元数据块,如需要则延迟创建。

Template Parameters
T协议数据类型。
Returns
协议信息指针,失败返回nullptr。

◆ init_protobufs()

template<typename T>
bool ngl::tprotocol::init_protobufs ( )
inlinestatic

从xmlprotocol元数据延迟解析protobuf支持的协议ID。

Template Parameters
T协议数据类型。
Returns
解析成功返回true,失败返回false。

◆ set_customs_index()

bool ngl::tprotocol::set_customs_index ( int32_t acustoms)
inlinestatic

在注册块运行前设置下一个自定义协议ID基数。

Parameters
acustoms自定义协议ID基数。
Returns
始终返回true。

◆ tp_customs()

template<typename ... ARGS>
void ngl::tprotocol::tp_customs ( int32_t aprotocolnum = -1,
int32_t ahigh = 0 )
inlinestatic

注册一个或多个自定义C++协议。

Template Parameters
ARGS协议数据类型列表。
Parameters
aprotocolnum协议ID,-1表示自动分配。
ahigh优先级值。

◆ tp_customs_script()

template<typename ... ARGS>
void ngl::tprotocol::tp_customs_script ( int32_t aprotocolnum = -1,
int32_t ahigh = 0 )
inlinestatic

注册一个或多个自定义协议并为其暴露脚本发送桥接。

Template Parameters
ARGS协议数据类型列表。
Parameters
aprotocolnum协议ID,-1表示自动分配。
ahigh优先级值。

The documentation for this class was generated from the following files: