-
Notifications
You must be signed in to change notification settings - Fork 2
/
RuneHMMInfo.h
77 lines (63 loc) · 1.2 KB
/
RuneHMMInfo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef _RUNE_HMM_INFO
#define _RUNE_HMM_INFO
#include <stdio.h>
#include <string.h>
enum RUNE_POS
{
RUNE_POS_B = 0,
RUNE_POS_E,
RUNE_POS_M,
RUNE_POS_S,
RUNE_POS_ALL,
};
//每个字的HMM对应的BEMS概率
struct _RuneHMMInfo
{
char m_cUsed; //0为未使用,1为使用
int m_nIndex; //内存池的位置
char m_szRune[4];
double m_dbProb;
_RuneHMMInfo()
{
Init();
}
void Init()
{
memset(m_szRune, 0, 4);
m_dbProb = 0;
m_nIndex = 0;
m_cUsed = 0;
}
void Set_Index(int nIndex)
{
m_nIndex = nIndex;
}
int Get_Index()
{
return m_nIndex;
}
};
//对应_RuneHMMInfo的内存池
class CRuneHMMPool
{
public:
CRuneHMMPool();
~CRuneHMMPool();
size_t Init(int nPoolCount, char* pData);
size_t Load(int nPoolCount, char* pData);
void Close();
char* GetCryptTable();
_RuneHMMInfo* Create();
int Get_Node_Offset(_RuneHMMInfo* pRuneHMMInfo);
_RuneHMMInfo* Get_NodeOffset_Ptr(int nOffset);
bool Delete(_RuneHMMInfo* pRuneHMMInfo);
private:
void prepareCryptTable();
private:
char* m_pCryptTable;
char* m_pBase; //整个内存开始地址
int m_nPoolCount;
int m_nCurrIndex;
_RuneHMMInfo* m_RuneHMMPoolList; //内存池列表
};
#endif