📄 structures.h
字号:
#ifndef DEFINEDSTRUCTURES
#define DEFINEDSTRUCTURES
#include<string.h>
#include "types.h"
struct eventStruct{
unsigned short int run;
btype level;
};
struct symbolStreamStruct{
eventStruct e;
symbolStreamStruct *next;
};
struct codeListStruct{
eventStruct *ep;
unsigned int times;
char *code;
codeListStruct *next;
};
struct decodeListStruct{
eventStruct ep;
unsigned int times;
char *code;
decodeListStruct *next;
};
struct dcCodeList{
short int diffValue;
unsigned short count;
char *code;
dcCodeList *next;
};
struct coordinate{
int x;
int y;
};
class DCDiffCount
{
public:
short int diffValue;
unsigned short int count;
DCDiffCount * link;
DCDiffCount();//生成头节点的构造函数
DCDiffCount(short int data1);//生成一般节点的构造函数
void IncreCount();
void InsertAfter(DCDiffCount *p);
DCDiffCount * RemoveAfter();
friend class DCDiffCountList;
};
class List{
public:
DCDiffCount *head,*tail;
List();
~List();
void MakeEmpty();
DCDiffCount * Find(short int data);
int Length();
void PrintList();
void InsertRear(DCDiffCount *p);
DCDiffCount *CreatNode(short int data);
DCDiffCount *DeleteNode(DCDiffCount *p);
};
class Node{
public:
short diffValue;
eventStruct Event;
Node* lchild,*rchild;
Node(){lchild=NULL;rchild=NULL;}
Node(unsigned short Run,btype Level,short diff,Node*left=NULL,Node*right=NULL){
diffValue=diff;
Event.run=Run;
Event.level=Level;
lchild=left;
rchild=right;
}
friend class BinaryTree;
};
class BinaryTree{
public:
Node*root;
BinaryTree(){root=NULL;}
~BinaryTree(){Destroy(root);}
void Destroy(Node* Current);
void CreateDC(dcCodeList* pdcCode,cltype dcCodeListlength);
void CreateAC(decodeListStruct* pacCode,cltype acCodeListlength);
void InsertDC(dcCodeList* pdcCode,Node* &b,unsigned short codeLen);
void InsertAC(decodeListStruct* pacCode,Node* &b,unsigned short codeLen);
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -