HufNode.cpp
Upload User: liruoru
Upload Date: 2007-07-02
Package Size: 43k
Code Size: 1k
Category:

Algorithm

Development Platform:

Visual C++

  1. // HufNode.cpp: implementation of the HufNode class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "HUF3.h"
  6. #include "HufNode.h"
  7. #ifdef _DEBUG
  8. #undef THIS_FILE
  9. static char THIS_FILE[]=__FILE__;
  10. #define new DEBUG_NEW
  11. #endif
  12. //////////////////////////////////////////////////////////////////////
  13. // Construction/Destruction
  14. //////////////////////////////////////////////////////////////////////
  15. HufNode::HufNode()
  16. {
  17. }
  18. HufNode::~HufNode()
  19. {
  20. }
  21. HufNode::HufNode(char c, double p)
  22. {
  23. name=c;
  24. weight=p;
  25. }
  26. void HufNode::initnode()
  27. {
  28. parent=0;
  29. lchild=0;
  30. rchild=0;
  31. weight=0;
  32. name=NULL;
  33. code=NULL;
  34. }
  35. char HufNode::GetName()
  36. {
  37. return name;
  38. }
  39. double HufNode::GetWeight()
  40. {
  41. return weight;
  42. }
  43. void HufNode::PutParent(int p)
  44. {
  45. parent=p;
  46. }
  47. void HufNode::PutLchild(int p)
  48. {
  49. lchild=p;
  50. }
  51. void HufNode::PutRchild(int p)
  52. {
  53. rchild=p;
  54. }
  55. void HufNode::PutWeight(double d)
  56. {
  57. weight=d;
  58. }
  59. int HufNode::GetParent()
  60. {
  61. return parent;
  62. }
  63. void HufNode::PutName(char c)
  64. {
  65. name=c;
  66. }