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

📄 listnode.cpp

📁 蒙特卡罗方法可以有效地解决复杂的工程问题
💻 CPP
字号:
// ListNode.cpp: implementation of the CListNode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "RayTrace.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

//构造函数,初始化指针
CListNode::CListNode()
{
	next = NULL ;
	pre = NULL ;
}

//析构函数,指针置空
CListNode::~CListNode()
{
	next = NULL ;
	pre = NULL ;
}

/*************************************************************************
 *
 * 函数名称:
 *   CListNode::SetNext
 *
 * 参数:
 *   CListNode *newnode			- 要插入链表的结点指针
 *
 * 返回值:
 *   无
 *
 * 说明:
 *   链表插入操作,在当前结点的后面插入新结点。
 *
 ************************************************************************/
void CListNode::SetNext(CListNode *newnode)
{
	ASSERT( newnode != NULL );

	newnode->next = next;
	next = newnode;
	newnode->pre = this;
	newnode->next->pre = newnode;
}

/*************************************************************************
 *
 * 函数名称:
 *   CListNode::SetPre
 *
 * 参数:
 *   CListNode *newnode			- 要插入链表的结点指针
 *
 * 返回值:
 *   无
 *
 * 说明:
 *   链表插入操作,在当前结点的前面插入新结点。
 *
 ************************************************************************/
void CListNode::SetPre(CListNode *newnode)
{
	ASSERT( newnode != NULL );
	ASSERT( pre != NULL );

	newnode->next = this;
	newnode->pre = pre;
	pre->next = newnode;
	pre = newnode;
}

/*************************************************************************
 *
 * 函数名称:
 *   CListNode::GetNext()
 *
 * 参数:
 *   无
 *
 * 返回值:
 *   CListNode*			- 返回当前结点后面的结点指针
 *
 * 说明:
 *   链表操作,获取当前结点后面的结点。
 *
 ************************************************************************/
CListNode* CListNode::GetNext()
{
	return next;
}

/*************************************************************************
 *
 * 函数名称:
 *   CListNode::GetPre()
 *
 * 参数:
 *   无
 *
 * 返回值:
 *   CListNode*			- 返回当前结点前面的结点指针
 *
 * 说明:
 *   链表操作,获取当前结点前面的结点。
 *
 ************************************************************************/
CListNode* CListNode::GetPre()
{
	return pre;
}

⌨️ 快捷键说明

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