hufnode.cpp

来自「Huffman编码1. 给出信源符号的一阶概率分布」· C++ 代码 · 共 85 行

CPP
85
字号
// HufNode.cpp: implementation of the HufNode class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "HUF3.h"
#include "HufNode.h"

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

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

HufNode::HufNode()
{

}

HufNode::~HufNode()
{

}

HufNode::HufNode(char c, double p)
{
	name=c;
	weight=p;
}

void HufNode::initnode()
{
	parent=0;
	lchild=0;
	rchild=0;
	weight=0;
	name=NULL;
	code=NULL;

}

char HufNode::GetName()
{
return name;
}

double HufNode::GetWeight()
{
	return weight;
}

void HufNode::PutParent(int p)
{
parent=p;
}

void HufNode::PutLchild(int p)
{
lchild=p;
}

void HufNode::PutRchild(int p)
{
rchild=p;
}

void HufNode::PutWeight(double d)
{
weight=d;
}

int HufNode::GetParent()
{
return parent;
}

void HufNode::PutName(char c)
{
name=c;
}

⌨️ 快捷键说明

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