⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nmsgnode.h

📁 奇迹世界公用文件源代码,研究网络游戏的朋友可以研究下
💻 H
字号:
#ifndef N_MSGNODE_H
#define N_MSGNODE_H
//------------------------------------------------------------------------------
/**
    @briefA doubly linked list node which can carry a msg.

    @author
    - RadonLabs GmbH 

    @since
    - 2005.6.30
    @remarks
    - 瘤肯 眠啊 
*/

#include <string.h>
#include "nnode.h"

//------------------------------------------------------------------------------
class nMsgNode : public nNode 
{
public:
    /// constructor
    nMsgNode(void* buf, int size);
    /// destructor
    ~nMsgNode();
    /// get pointer to message
    void* GetMsgPtr() const;
    /// get size of message
    int GetMsgSize() const;

private:
    char *msgBuf;
    int msgSize;
};

//------------------------------------------------------------------------------
/**
*/
inline 
nMsgNode::nMsgNode(void *buf, int size)
{
    ASSERT(buf);
    ASSERT(size > 0);
    this->msgBuf  = (char*) n_malloc(size);
    this->msgSize = size;
    ASSERT(this->msgBuf);
    memcpy(this->msgBuf, buf, size);
}

//------------------------------------------------------------------------------
/**
*/
inline 
nMsgNode::~nMsgNode()
{
    n_free(this->msgBuf);
}     

//------------------------------------------------------------------------------
/**
*/
inline 
void*
nMsgNode::GetMsgPtr() const
{
    return this->msgBuf;
}

//------------------------------------------------------------------------------
/**
*/
inline 
int 
nMsgNode::GetMsgSize() const
{
    return this->msgSize;
}

//------------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -