ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
nrfun.h File Reference

声明Actor消息分发注册表。 More...

#include "actor/actor_base/core/handle_pram.h"
#include "actor/actor_base/core/actor_base.h"
#include "tools/type.h"
#include <unordered_map>
#include <functional>
#include <optional>

Classes

class  ngl::nrfunbase
 消息处理函数元数据结构体。 More...
struct  ngl::message< T >
 强类型消息信封模板。 More...
class  ngl::nrfun< TDerived >
 消息分发注册表模板类。 More...

Typedefs

using ngl::tlogicfun = std::function<void(actor_base*, i32_threadid, handle_pram&)>
 Actor消息分发表中使用的类型擦除处理函数签名。
using ngl::tnotfindfun = std::function<void(i32_threadid, handle_pram&)>
 当协议ID未在Actor类型中注册时调用的兜底处理函数。
template<typename TDerived, typename TPRAM>
using ngl::Tfun = bool (TDerived::*)(const message<TPRAM>&)
 成员函数处理函数类型别名。

Detailed Description

声明Actor消息分发注册表。

提供消息分发机制,将协议ID映射到处理函数。 支持多种注册方式:std::function、成员函数、转发协议等。

Typedef Documentation

◆ Tfun

template<typename TDerived, typename TPRAM>
using ngl::Tfun = bool (TDerived::*)(const message<TPRAM>&)

成员函数处理函数类型别名。

Template Parameters
TDerived派生Actor类型
TPRAM消息参数类型