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


C++ Statistic类代码示例

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


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

示例1: Statistic

void Startphase::setStatistics(vector<Player*>* gamePlayers) {
	//Select Desired statitics to follow
	int option;
	Statistic* stat = new Statistic();
	do {
		cout << "Select desired statistics to follow: " << endl;
		cout << "0. Follow Number Of Countries per player;" << endl;
		cout << "1. Follow Total Number of Armies per player" << endl;
		cout << "2. Follow Number of cards per player" << endl;
		cout << "3. Done" << endl;
		cin >> option;
		switch (option) {
		case 0:
			stat = new CountriesStat(stat);		// Decorate statistics with Country Stats
			break;
		case 1:
			stat = new ArmiesStat(stat);		// Decorate statistics with Armies Stats
			break;
		case 2:
			stat = new CardsStat(stat);			// Decorate statistics with Cards Stats
		}
	} while (option != 3);

	for (int i = 0; i < gamePlayers->size(); i++) {
		(*gamePlayers)[i]->attach(stat);
		stat->attachPlayer((*gamePlayers)[i]);
	}
}
开发者ID:escrimeuse,项目名称:risk,代码行数:28,代码来源:Startphase.cpp

示例2: testStatistics

/**
 * Example of a test. To be completed.
 *
 */
bool testStatistics()
{
  unsigned int nbok = 0;
  unsigned int nb = 3;
  
  trace.beginBlock ( "Testing Statistics ..." );

  Statistic<double> stat;
  
  for(unsigned int k=0; k < 1000; k++)
    stat.addValue((double)k);
  
  stat.terminate();
  
  trace.info() << "Mean value = "<<stat.mean()  << std::endl;
  nbok += (stat.mean()==499.5) ? 1 : 0; 
  trace.info() << "Variance value = "<<stat.variance()<<std::endl;
  trace.info() << "Max value = "<<stat.max()<<std::endl;
  nbok += (stat.max()==999) ? 1 : 0; 
  trace.info() << "Min value = "<<stat.min()<<std::endl;
  nbok += (stat.min()==0)  ? 1 : 0; 
 
  trace.info() << "(" << nbok << "/" << nb << ") "
         << "true == true" << std::endl;
  trace.endBlock();
  
  return nbok == nb;
}
开发者ID:BorisMansencal,项目名称:DGtal,代码行数:32,代码来源:testStatistics.cpp

示例3: main

int main()  {
    Statistic statistic;

    statistic.setUDPTraffic(11);

    statistic.WriteToFile("/re/unitTest/GenerateDataForML/aaa", "aaa");
    return 0;
}
开发者ID:sangszhou,项目名称:RedundancyElimination,代码行数:8,代码来源:testStatistic.cpp

示例4: PrintStats

 void PrintStats(const std::string& title, const Statistic& stats)
 {
     using namespace DPL::Colors::Text;
     printf("\n%sResults [%s]: %s\n", BOLD_GREEN_BEGIN, title.c_str(), BOLD_GREEN_END);
     printf("%s%s%3d%s\n", CYAN_BEGIN,     "Total tests:            ", stats.GetTotal(), CYAN_END);
     printf("  %s%s%3d%s\n", CYAN_BEGIN,   "Succeeded:            ", stats.GetPassed(), CYAN_END);
     printf("  %s%s%3d%s\n", CYAN_BEGIN,   "Failed:               ", stats.GetFailed(), CYAN_END);
     printf("  %s%s%3d%s\n", CYAN_BEGIN,   "Ignored:              ", stats.GetIgnored(), CYAN_END);
 }
开发者ID:tizenorg,项目名称:platform.framework.web.wrt-commons,代码行数:9,代码来源:test_results_collector.cpp

示例5: ShowStatictics

void MultyBuffer::ShowStatictics(Statistic& statistic, std::ofstream& resFile)
{
	for(auto i = statistic.begin(); i != statistic.end(); ++i)
	{
		const double average = static_cast<double>(i->second.types) / static_cast<double>( i->second.seconds);

		resFile.write( reinterpret_cast< const char* >(& ( i->first ) ), sizeof( boost::uint32_t ) );
		resFile.write( reinterpret_cast< const char* >( &average ), sizeof(double) );
	}
}
开发者ID:Gedeon-by,项目名称:cpp_craft_0314,代码行数:10,代码来源:small_buffer.cpp

示例6: main

int main()
{
    Statistic stats;
    stats.Add(5);
    stats.Add(10);
    stats.Add(12);
    stats.Add(6);
    stats.Add(15);
    stats.Add(4);

    stats.getNumbers();
    stats.getAverage();
    stats.getSTD();
    

    Statistic stats1;
    stats1.Add(5.4);
    stats1.Add(10);
    stats1.Add(12.3);
    stats1.Add(6.4);
    stats1.Add(15);
    stats1.Add(4.332);

    stats1.getNumbers();
    stats1.getAverage();
    stats1.getSTD();

    //using https://www.easycalculation.com/statistics/standard-deviation.php
    //I verified that my equations were correct
    return 0;
}
开发者ID:Elizaliz,项目名称:CPlusPlusHW,代码行数:31,代码来源:Module2.cpp

示例7: QString

void NoGUI::loadState()
{
    IniFile iniFile;
    iniFile.setFilename( QString("%1/state.ini").arg(m_filePath) );
    if(!iniFile.ready()) return;
    if(m_monteCarlo) m_monteCarlo->loadState(&iniFile);
    m_geometry->loadState(&iniFile);
    for(QVariant &variant : m_statistics) {
        Statistic *statistic = variant.value<Statistic*>();
        statistic->loadState(&iniFile);
    }
}
开发者ID:andeplane,项目名称:zsm-5-pore-generator,代码行数:12,代码来源:nogui.cpp

示例8: CountValidLast

long CountValidLast( StatList *byStat )
{
	Statistic *p;
	long i = 0, count = 0;

	while( (p=byStat->GetStat(i)) && i<byStat->num ){
		if ( p->GetVisitIn() != 0 )
			count++;
		i++;
	}
	return count;
}
开发者ID:rauls,项目名称:iReporter,代码行数:12,代码来源:Report.cpp

示例9: startQuery

void QueryLoggingSolver::startQuery(const Query& query, const char* typeName,
                                    const Query* falseQuery,
                                    const std::vector<const Array*> *objects) {
    Statistic *S = theStatisticManager->getStatisticByName("Instructions");
    uint64_t instructions = S ? S->getValue() : 0;

    logBuffer << queryCommentSign << " Query " << queryCount++ << " -- "
              << "Type: " << typeName << ", "
              << "Instructions: " << instructions << "\n";
    
    printQuery(query, falseQuery, objects);
    
    startTime = getWallTime();
    
}
开发者ID:BovInspector,项目名称:project,代码行数:15,代码来源:QueryLoggingSolver.cpp

示例10: badMove

void EndlessGameWidget::badMove()
{
  // Add sound effect
  PublicGameSounds::addSound(PublicGameSounds::BadMove);

  statistic.changeStatistic(Statistic::BadMoveCount, 1, true);
}
开发者ID:tecton,项目名称:HexGame,代码行数:7,代码来源:endlessgamewidget.cpp

示例11: startQuery

 void startQuery(const Query& query, const char *typeName,
                 const ref<Expr> *evalExprsBegin = 0,
                 const ref<Expr> *evalExprsEnd = 0,
                 const Array * const* evalArraysBegin = 0,
                 const Array * const* evalArraysEnd = 0) {
   Statistic *S = theStatisticManager->getStatisticByName("Instructions");
   uint64_t instructions = S ? S->getValue() : 0;
   os << "# Query " << queryCount++ << " -- "
      << "Type: " << typeName << ", "
      << "Instructions: " << instructions << "\n";
   printer->printQuery(os, query.constraints, query.expr,
                       evalExprsBegin, evalExprsEnd,
                       evalArraysBegin, evalArraysEnd);
   
   startTime = getWallTime();
 }
开发者ID:Edward-L,项目名称:symexe,代码行数:16,代码来源:PCLoggingSolver.cpp

示例12: main

int main (int argc, char **argv)
{
	clock_t t1,t2;
	t1 = clock();
	
	/* 
	 * Parses command line 
	 */
	try {
		Options::Get().Parse(argc, argv);
	}
	catch (exception &e) {
		cerr << e.what() << "\n";
		Options::Get().print_usage();
		exit(0);
	}
	cout << "Statistic: " << Options::Get().statistic << "\n";
	/* 
	 * Initiates Statistic factory
	 */
	try {
	  AddAllStatistics();
	} catch (exception &e){ 
		cerr << e.what() << "\n";
		exit(0);
	}
	
	/*
	 * Read the multiple alignment 
	 */
	Msa msa(Options::Get().input_fname);
	
	/* 
	 * Calculate the statistic & print it
	 */
	Statistic * stat = StatisticFactory::CreateByName(Options::Get().statistic);
	stat->calculate(msa);
	stat->print(msa);
	delete stat;
	
	/*
	 * Print time
	 */
	t2 = clock();		
	cout << "Mstatx computed in "<< (t2 - t1) / (double)CLOCKS_PER_SEC <<" seconds\nResults are written in " << Options::Get().output_fname << "\n\n";
	return 0;
}
开发者ID:gcollet,项目名称:MstatX,代码行数:47,代码来源:main.cpp

示例13: startQuery

	void startQuery(const Query& query, const char *typeName, const std::vector<const Array*>* objects=NULL)
	{
		Statistic *S = theStatisticManager->getStatisticByName("Instructions");
		uint64_t instructions = S ? S->getValue() : 0;
		os << ";SMTLIBv2 Query " << queryCount++ << " -- "
		   << "Type: " << typeName << ", "
		   << "Instructions: " << instructions << "\n";
		printer->setQuery(query);

		if(objects!=NULL)
			printer->setArrayValuesToGet(*objects);

		printer->generateOutput();
		os << "\n";

		startTime = getWallTime();
	}
开发者ID:h15,项目名称:klee,代码行数:17,代码来源:SMTLIBLoggingSolver.cpp

示例14: merge

void Registry::merge(const Registry &other)
{
    for (const_iterator i = other.begin(); i != other.end(); i++)
    {
        boost::ptr_map<std::string, Statistic>::iterator pos = statistics.find(i->getName());
        if (pos == statistics.end())
        {
            Statistic *clone = i->clone();
            std::string name = clone->getName();
            statistics.insert(name, clone);
        }
        else
        {
            pos->second->merge(*i);
        }
    }
}
开发者ID:bmerry,项目名称:mlsgpu,代码行数:17,代码来源:statistics.cpp

示例15: DBIO_LoadStatistic

static long DBIO_LoadStatistic( VDinfoP VDptr, Statistic *stat, gzFile fh, long useOtherNames, char *id )
{
	long	dataread = 0;

	if ( !fh ) return 0;

	// read one statistic
	if ( stat ) {
		dataread += gzread( fh, stat ,sizeof(Statistic) );

		if ( useOtherNames == NAMEIS_NORMAL || useOtherNames == NAMEIS_IP ) {
			if ( stat->GetName() && stat->length>0 ){
				char *name;
				name = stat->AllocateName( stat->length );
				dataread += ReadString( fh, name, stat->length );
			}
		} else 
		if ( (long)stat->GetName() == NAMEIS_STATIC )
		{
			if( !mystrcmpi( "hour", id ) )					RestoreHourNames( stat );
			else if( !mystrcmpi( "wkday", id ) )			RestoreWeekdaysNames( stat );
			else if( !mystrcmpi( "wdays", id ) )			RestoreHourNames( stat );
			else if( !mystrcmpi( "oper", id ) )				RestoreOpersysNames( stat );
			else if( !mystrcmpi( "errs", id ) )				RestoreErrorsNames( stat );
			else if( !mystrcmpi( s_errorsWithTopReferralsTag, id ) ) RestoreErrorsNames( stat );
			else if( !mystrcmpi( "pages", id ) )			RestoreStatisticName( stat, VDptr->byFile );
			else if( !mystrcmpi( "down", id ) )				RestoreStatisticName( stat, VDptr->byFile );
			else if( !mystrcmpi( "audio", id ) ) 			RestoreStatisticName( stat, VDptr->byFile );
			else if( !mystrcmpi( "video", id ) ) 			RestoreStatisticName( stat, VDptr->byFile );
			else if( !mystrcmpi( s_brokenLinkReferalsTag, id ) ) 	RestoreStatisticName( stat, VDptr->byRefer );
			else if( !mystrcmpi( s_intBrokenLinkReferalsTag, id ) ) RestoreStatisticName( stat, VDptr->byRefer );
			else											stat->name = NULL;
		}
	} else {
	// read to where? empty area just incase
		Statistic Lstat;
		dataread += gzread( fh, &Lstat ,sizeof(Statistic) );
		if ( Lstat.GetName() && !useOtherNames ) {
			char tmp[1024];
			dataread += gzread( fh, tmp , stat->length );
		}
		if ( (long)stat->GetName() == NAMEIS_STATIC ) 
			stat->name = NULL;
	}
	return dataread;
}
开发者ID:rauls,项目名称:iReporter,代码行数:46,代码来源:engine_dbio.cpp


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