projectdb.h

来自「C++编写的代码」· C头文件 代码 · 共 46 行

H
46
字号
#ifndef PROJECT_DB_H
#define PROJECT_DB_H

#pragma warning(disable:4786)

#include <map>
#include <vector>

typedef unsigned short ItemSubscriptType;


struct ProjectedSeqInfo
{
	ProjectedSeqInfo(unsigned SIndex, unsigned suffixPos):SIndex_(SIndex), suffixPos_(suffixPos)
	{}
	unsigned SIndex_;//序列号标记
	unsigned suffixPos_;
};

//------------------------------------------------------------------------
//------------------------------------------------------------------------

class ProjectDB
{
public:
	void InsertItemSeqIndex(ItemSubscriptType itemSubscript, unsigned seqIndex, unsigned suffixPos)
	{//
		if ((projectedDB_[itemSubscript].empty())||
			(seqIndex != projectedDB_[itemSubscript].back().SIndex_))
			projectedDB_[itemSubscript].push_back(ProjectedSeqInfo(seqIndex, suffixPos));
	}
	
	//获取候选序列的index向量。
	void GetCandidateSIndexVec(ItemSubscriptType itemSubscript,
							   std::vector<ProjectedSeqInfo>& CandSIndexVec)
	{
		CandSIndexVec = projectedDB_[itemSubscript];
	}

protected:
private:
	std::map<ItemSubscriptType, std::vector<ProjectedSeqInfo> >projectedDB_;	
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?