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

基于node_pack的发送队列。 More...

#include <node_pack.h>

Public Member Functions

template<typename T>
void push (const std::shared_ptr< T > &apack)
 向队列添加数据包。
bool pop (std::shared_ptr< node_pack > &apack, bool aasync)
 从队列取出数据包。
template<typename TNET, typename TNDATA>
void send (bool aasync, const std::shared_ptr< TNDATA > &adata, TNET *anet, void(TNET::*asendfun)(const std::shared_ptr< TNDATA > &, const std::shared_ptr< node_pack > &))
 取出数据包并执行发送函数。

Detailed Description

基于node_pack的发送队列。

提供网络会话级别的消息缓冲和异步发送功能。 主要用于:

  • 缓存待发送的网络数据包
  • 支持异步发送模式
  • 与网络传输层集成
Note
内部使用send_list模板,元素类型为std::shared_ptr<node_pack>。

Member Function Documentation

◆ pop()

bool ngl::npack_list::pop ( std::shared_ptr< node_pack > & apack,
bool aasync )
inline

从队列取出数据包。

Parameters
apack输出参数,存储取出的数据包
aasync是否为异步模式
Returns
true 取出成功
false 队列为空

◆ push()

template<typename T>
void ngl::npack_list::push ( const std::shared_ptr< T > & apack)
inline

向队列添加数据包。

Template Parameters
T数据包类型
Parameters
apack数据包共享指针

◆ send()

template<typename TNET, typename TNDATA>
void ngl::npack_list::send ( bool aasync,
const std::shared_ptr< TNDATA > & adata,
TNET * anet,
void(TNET::* asendfun )(const std::shared_ptr< TNDATA > &, const std::shared_ptr< node_pack > &) )
inline

取出数据包并执行发送函数。

Template Parameters
TNET网络传输类型
TNDATA数据类型
Parameters
aasync是否为异步模式
adata要发送的数据
anet网络传输对象指针
asendfun发送成员函数指针

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