基于node_pack的发送队列。
More...
#include <node_pack.h>
|
| 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 > &)) |
| | 取出数据包并执行发送函数。
|
基于node_pack的发送队列。
提供网络会话级别的消息缓冲和异步发送功能。 主要用于:
- 缓存待发送的网络数据包
- 支持异步发送模式
- 与网络传输层集成
- Note
- 内部使用send_list模板,元素类型为std::shared_ptr<node_pack>。
◆ 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
-
- Parameters
-
◆ 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
-
- Parameters
-
| aasync | 是否为异步模式 |
| adata | 要发送的数据 |
| anet | 网络传输对象指针 |
| asendfun | 发送成员函数指针 |
The documentation for this class was generated from the following file: