huffmanElement.h
Go to the documentation of this file.
00001 #ifndef HUFFMAN_ELEMENT_HEADER
00002 #define HUFFMAN_ELEMENT_HEADER
00003 
00004 #include <list>
00005 
00006 using namespace std;
00007 
00011 class HuffmanElement {
00012         private:
00016                 static int count_nodes;
00020                 static int longest_code;
00024                 int name;
00028                 char letter;
00032                 HuffmanElement* left;
00036                 HuffmanElement* right;
00040                 int value;
00044                 HuffmanElement* parent;
00048                 bool is_right;
00052                 bool* lookup_code;
00056                 unsigned int lookup_code_length;
00057 
00058         public:
00059                 HuffmanElement();
00060                 HuffmanElement(char cur_letter, int cur_value);
00061                 HuffmanElement(HuffmanElement* cur_left, HuffmanElement* cur_right, int cur_value);
00062                 HuffmanElement(const HuffmanElement& original);
00063                 virtual ~HuffmanElement();
00064                 virtual HuffmanElement& operator=(const HuffmanElement& original);
00065                 virtual bool operator> (const HuffmanElement& compare) const;
00066                 virtual char get_letter() const;
00067                 virtual int get_value() const;
00068                 virtual int get_name() const;
00069                 virtual bool get_is_right() const;
00070                 virtual HuffmanElement* get_parent();
00071                 virtual HuffmanElement* get_left();
00072                 virtual HuffmanElement* get_right();
00073                 virtual bool* get_lookup_code();
00074                 virtual unsigned int get_lookup_code_length() const;
00075                 virtual void set_parent(HuffmanElement* cur_parent, bool cur_is_right);
00076                 virtual void add_lookup_code(bool code);
00077                 virtual int get_longest_code();
00078 
00079         private:
00080                 void copy_huffman_element(const HuffmanElement& original);
00081                 void delete_huffman_element();
00082 };
00083 
00087 struct compareCharacters {
00088   bool operator ()(HuffmanElement *left, HuffmanElement *right) {
00089           return *left > *right;
00090   }
00091 };
00092 
00093 
00094 #endif
 All Classes Files Functions