a
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
// SptPtSort.h: interface for the CSptPtSort class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SPTPTSORT_H__3F8B4F6F_B818_476C_963E_8C5AA6173AA3__INCLUDED_)
|
||||
#define AFX_SPTPTSORT_H__3F8B4F6F_B818_476C_963E_8C5AA6173AA3__INCLUDED_
|
||||
|
||||
#include "SptRecord.h"
|
||||
#include <map>
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
#define MAX_KEY_ARRAY_CNT 1024
|
||||
//单个子节点信息
|
||||
typedef struct ST_SPT_PT_SUBKEY_INFO
|
||||
{
|
||||
WORD wMPt; //M点的位置
|
||||
WORD wNPt; //N点的位置
|
||||
int iPosIndex; //该点在链表中的位置信息
|
||||
bool bIsFind; //是否被查找过
|
||||
}STSptPtSubKeyInfo;
|
||||
//复合子节点信息
|
||||
typedef struct ST_SPT_PT_CPl_SUBKEY_INFO
|
||||
{
|
||||
std::vector<STSptPtSubKeyInfo> vtSptSubkey;
|
||||
bool bIsAllFind; //是否被全部查找过
|
||||
ST_SPT_PT_CPl_SUBKEY_INFO()
|
||||
{
|
||||
vtSptSubkey.clear();
|
||||
bIsAllFind = false;
|
||||
}
|
||||
void ClearContent()
|
||||
{
|
||||
vtSptSubkey.clear();
|
||||
bIsAllFind = false;
|
||||
}
|
||||
int FindMinNPosIndex()
|
||||
{
|
||||
if (bIsAllFind)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
int iIndex = -1;
|
||||
WORD wMin = 65535;
|
||||
int iSize = vtSptSubkey.size();
|
||||
int i;
|
||||
for(i = 0; i < vtSptSubkey.size(); i++)
|
||||
{
|
||||
if (vtSptSubkey[i].bIsFind)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (wMin > vtSptSubkey[i].wNPt)
|
||||
{
|
||||
wMin = vtSptSubkey[i].wNPt;
|
||||
iIndex = i;
|
||||
}
|
||||
}
|
||||
if (iIndex < 0)
|
||||
{
|
||||
bIsAllFind = true;
|
||||
}
|
||||
return iIndex;
|
||||
}
|
||||
|
||||
}STSptPtCplSubkeyInfo;
|
||||
|
||||
typedef struct ST_SPT_PT_SUBKEY_VT
|
||||
{
|
||||
std::map<int,STSptPtSubKeyInfo> mapSptSubkeyInfo;
|
||||
std::map<int,STSptPtCplSubkeyInfo> mapSptCplSubkey;
|
||||
ST_SPT_PT_SUBKEY_VT()
|
||||
{
|
||||
mapSptSubkeyInfo.clear();
|
||||
mapSptCplSubkey.clear();
|
||||
}
|
||||
void ClearContent()
|
||||
{
|
||||
mapSptSubkeyInfo.clear();
|
||||
mapSptCplSubkey.clear();
|
||||
}
|
||||
|
||||
}STSptPtSubKetVt;
|
||||
|
||||
class CSptPtSort
|
||||
{
|
||||
public:
|
||||
CSptPtSort();
|
||||
virtual ~CSptPtSort();
|
||||
|
||||
bool MultiChannlePtSortForMNB(CPtrArray* pSptPtArray);
|
||||
bool MultiChannlePtSort(CPtrArray* pSptPtArray);
|
||||
bool MultiChannlePtCplSort(CPtrArray* pSptPtArray);
|
||||
|
||||
protected:
|
||||
std::map<int, STSptPtSubKetVt> m_mapSptKey;
|
||||
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_SPTPTSORT_H__3F8B4F6F_B818_476C_963E_8C5AA6173AA3__INCLUDED_)
|
||||
Reference in New Issue
Block a user