当前位置: 首页>>代码示例>>C++>>正文


C++ CheckSum::AddData方法代码示例

本文整理汇总了C++中CheckSum::AddData方法的典型用法代码示例。如果您正苦于以下问题:C++ CheckSum::AddData方法的具体用法?C++ CheckSum::AddData怎么用?C++ CheckSum::AddData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CheckSum的用法示例。


在下文中一共展示了CheckSum::AddData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BeginTurn

void DataCheck::BeginTurn(void)
{
	CheckSum	*check;
	
	CivArchive	*archive;
	
	sint32	i, j;
	
	clock_t start, finish;

	for(i=CRC_TYPE_MIN; i<CRC_TYPE_MAX; i++)
		for (j=0; j<CRC_ARRAY_MAX; j++)
			m_old_crc[i][j] = m_crc[i][j];
		
	
	memset(&m_time, 0, CRC_TYPE_MAX * sizeof(uint32));
	
	start = clock();
	archive = new CivArchive();
	archive->SetStore();
	check = new CheckSum() ;
	// No idea what was serialized here
	check->AddData(archive->GetStream(), archive->StreamLen());
	check->Done(m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_0], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_1], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_2], m_crc[CRC_TYPE_GLOBAL][CRC_ARRAY_3]);
	delete archive;
	delete check;
	finish = clock();
	m_time[CRC_TYPE_GLOBAL] = finish - start;
	// should be replaced by:
//	CHECK_DB(???, CRC_TYPE_GLOBAL);

	CHECK_DB(g_rand, CRC_TYPE_RAND);

	start = clock();
	archive = new CivArchive();
	archive->SetStore();
	check = new CheckSum();

	// Fill in missing databases
	g_theAdvanceDB->Serialize(*archive);
	g_theAdvanceBranchDB->Serialize(*archive);
	g_theAdvanceListDB->Serialize(*archive);
	g_theAgeDB->Serialize(*archive);
	g_theAgeCityStyleDB->Serialize(*archive);
	g_theBuildListSequenceDB->Serialize(*archive);
	g_theCitySizeDB->Serialize(*archive);
	g_theCityStyleDB->Serialize(*archive);
	g_theCivilisationDB->Serialize(*archive);
	g_theConstDB->Serialize(*archive);                  // Old database
	g_theDifficultyDB->Serialize(*archive);
	g_theDiplomacyDB->Serialize(*archive);
	g_theDiplomacyProposalDB->Serialize(*archive);
	g_theDiplomacyThreatDB->Serialize(*archive);
	g_theEndGameObjectDB->Serialize(*archive);
	g_theGoalDB->Serialize(*archive);
	g_theGovernmentDB->Serialize(*archive);
	g_theIconDB->Serialize(*archive);
	g_theImprovementListDB->Serialize(*archive);
	g_theMapIconDB->Serialize(*archive);
	g_theMapDB->Serialize(*archive);
	g_theOrderDB->Serialize(*archive);
	g_theUVDB->Serialize(*archive);                     // Old database
	g_thePersonalityDB->Serialize(*archive);
	g_thePollutionDB->Serialize(*archive);
	g_thePopDB->Serialize(*archive);
	g_theResourceDB->Serialize(*archive);
	g_theRiskDB->Serialize(*archive);
	g_theSoundDB->Serialize(*archive);
	g_theSpecialAttackInfoDB->Serialize(*archive);
	g_theSpecialEffectDB->Serialize(*archive);
	g_theSpriteDB->Serialize(*archive);
	g_theStrategyDB->Serialize(*archive);
	g_theTerrainDB->Serialize(*archive);
	g_theUnitDB->Serialize(*archive);
	g_theUnitBuildListDB->Serialize(*archive);
	g_theWonderDB->Serialize(*archive);
	g_theWonderBuildListDB->Serialize(*archive);

	check->AddData(archive->GetStream(), archive->StreamLen());
	check->Done(m_crc[CRC_TYPE_DB][CRC_ARRAY_0], m_crc[CRC_TYPE_DB][CRC_ARRAY_1], m_crc[CRC_TYPE_DB][CRC_ARRAY_2], m_crc[CRC_TYPE_DB][CRC_ARRAY_3]);
	delete archive;
	delete check;
	finish = clock();
	m_time[CRC_TYPE_DB] = finish - start;

	// Continue with single database check
	
	start = clock();
	archive = new CivArchive();
	archive->SetStore();
	check = new CheckSum();
//	g_theProfileDB->Serialize(*archive);
	check->AddData(archive->GetStream(), archive->StreamLen());
	check->Done(m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_0], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_1], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_2], m_crc[CRC_TYPE_PROFILE_DB][CRC_ARRAY_3]);
	delete archive;
	delete check;
	finish = clock();
	m_time[CRC_TYPE_PROFILE_DB] = finish - start;

	
//.........这里部分代码省略.........
开发者ID:talentlesshack,项目名称:C2P2,代码行数:101,代码来源:DataCheck.cpp


注:本文中的CheckSum::AddData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。