encoder.h
来自「Implementation for the Huffman Cod in Vi」· C头文件 代码 · 共 67 行
H
67 行
#pragma once
#include "HuffmanTree.h"
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <assert.h>
class Encoder
{
public:
// Constructor with parameters
// fileName = the name of the input file
Encoder(LPCWSTR inputFile, LPCWSTR outputFile);
// Destructor
~Encoder(void);
public:
// Encode the input file
void Encode();
private:
// Write the codification of the leaf in buffer
// When buffer become full it's written to file
void WriteToBuffer(unsigned int leafNumber);
// Write the codification of the sumbol in buffer
// When buffer become full it's written to file
void WriteToBuffer(SYMBOL_TYPE symbol);
// Write the buffer to file
void WriteBufferToFile();
protected:
// The intput file
//int m_inputFile;
//std::ifstream m_inputFile;
HANDLE m_inputFile;
// The output file
//int m_outputFile;
//std::ofstream m_outputFile;
HANDLE m_outputFile;
private:
// The Huffman tree used for encoding
HuffmanTree m_tree;
// va retine codificarea pana la scriere in fisier
// codificarea va fi inversata, de la frunze la radacina si nu de la radacina la frunze
bool m_buffer[SYMBOL_SIZE];
// the buffer's contor
unsigned int m_contorBuffer;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?