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


C++ stringstream::str方法代码示例

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


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

示例1:

 ~ScoreComparerTestFixture()    //TearDown fixture
 {
     m_msg.str("");
     m_msg << endl;
 }
开发者ID:lenmus,项目名称:lenmus,代码行数:5,代码来源:lenmus_test_score_corrector.cpp

示例2: check_keys

bool cScreenGirlDetails::check_keys()
{
	if (g_LeftArrow)
	{
		g_LeftArrow = false;
		PrevGirl();
		return true;
	}
	if (g_RightArrow)
	{
		g_RightArrow = false;
		NextGirl();
		return true;
	}

	if (g_AltKeys)
	{
		if (g_A_Key)
		{
			g_A_Key = false;
			PrevGirl();
			return true;
		}
		if (g_D_Key)
		{
			g_D_Key = false;
			NextGirl();
			return true;
		}
		if (g_H_Key || g_J_Key)
		{
			int mod = 1; if (g_H_Key) mod = -1;
			g_Girls.UpdateStat(selected_girl, STAT_HOUSE, mod);
			g_H_Key = g_J_Key = false;
			SliderValue(houseperc_id, g_Girls.GetStat(selected_girl, STAT_HOUSE));
			ss.str("");
			ss << gettext("House Percentage: ") << g_Girls.GetStat(selected_girl, STAT_HOUSE) << gettext("%");
			EditTextItem(ss.str(), housepercval_id);
			// Rebelliousness might have changed, so update details
			if (DetailLevel == 0)
			{
				string detail = g_Girls.GetDetailsString(selected_girl);
				EditTextItem(detail, girldesc_id);
			}

			return true;
		}
		if (g_S_Key)
		{
			g_S_Key = false;
			if (g_ShiftDown)
			{
				DetailLevel = 2;
				EditTextItem(g_Girls.GetThirdDetailsString(selected_girl), girldesc_id);
			}
			else
			{
				if (DetailLevel == 0)		{ DetailLevel = 1; EditTextItem(g_Girls.GetMoreDetailsString(selected_girl), girldesc_id); }
				else						{ DetailLevel = 0; EditTextItem(g_Girls.GetDetailsString(selected_girl), girldesc_id); }
			}
			return true;
		}
		if (g_SpaceKey)
		{
			g_SpaceKey = false;
			g_WinManager.push("Gallery");
			g_InitWin = true;
			return true;
		}
	}
	return false;
}
开发者ID:diamondialis,项目名称:crazys-wm-mod,代码行数:72,代码来源:cScreenGirlDetails.cpp

示例3: setprecision

DLLEXP void h3dutShowFrameStats( H3DRes fontMaterialRes, H3DRes boxMaterialRes, int mode )
{
	static stringstream text;
	static float curFPS = 30;
	static float timer = 100;
	static float fps = 30;
	static float frameTime = 0;
	static float animTime = 0;
	static float geoUpdateTime = 0;
	static float particleSimTime = 0;
	static float fwdLightsGPUTime = 0;
	static float defLightsGPUTime = 0;
	static float shadowsGPUTime = 0;
	static float particleGPUTime = 0;

	// Calculate FPS
	float curFrameTime = h3dGetStat( H3DStats::FrameTime, true );
	curFPS = 1000.0f / curFrameTime;
	
	timer += curFrameTime / 1000.0f;
	if( timer > 0.7f )
	{	
		fps = curFPS;
		frameTime = curFrameTime;
		animTime = h3dGetStat( H3DStats::AnimationTime, true );
		geoUpdateTime = h3dGetStat( H3DStats::GeoUpdateTime, true );
		particleSimTime = h3dGetStat( H3DStats::ParticleSimTime, true );
		fwdLightsGPUTime = h3dGetStat( H3DStats::FwdLightsGPUTime, true );
		defLightsGPUTime = h3dGetStat( H3DStats::DefLightsGPUTime, true );
		shadowsGPUTime = h3dGetStat( H3DStats::ShadowsGPUTime, true );
		particleGPUTime = h3dGetStat( H3DStats::ParticleGPUTime, true );
		timer = 0;
	}
	else
	{
		// Reset accumulative counters
		h3dGetStat( H3DStats::AnimationTime, true );
		h3dGetStat( H3DStats::GeoUpdateTime, true );
		h3dGetStat( H3DStats::ParticleSimTime, true );
	}
	
	if( mode > 0 )
	{
		// InfoBox
		beginInfoBox( 0.03f, 0.03f, 0.32f, 4, "Frame Stats", fontMaterialRes, boxMaterialRes );
		
		// FPS
		text.str( "" );
		text << fixed << setprecision( 2 ) << fps;
		addInfoBoxRow( "FPS", text.str().c_str() );
		
		// Triangle count
		text.str( "" );
		text << (int)h3dGetStat( H3DStats::TriCount, true );
		addInfoBoxRow( "Tris", text.str().c_str() );
		
		// Number of batches
		text.str( "" );
		text << (int)h3dGetStat( H3DStats::BatchCount, true );
		addInfoBoxRow( "Batches", text.str().c_str() );
		
		// Number of lighting passes
		text.str( "" );
		text << (int)h3dGetStat( H3DStats::LightPassCount, true );
		addInfoBoxRow( "Lights", text.str().c_str() );
	}

	if( mode > 1 )
	{
		// Video memory
		beginInfoBox( 0.03f, 0.30f, 0.32f, 2, "VMem", fontMaterialRes, boxMaterialRes );
		
		// Textures
		text.str( "" );
		text << h3dGetStat( H3DStats::TextureVMem, false ) << "mb";
		addInfoBoxRow( "Textures", text.str().c_str() );
		
		// Geometry
		text.str( "" );
		text << h3dGetStat( H3DStats::GeometryVMem, false ) << "mb";
		addInfoBoxRow( "Geometry", text.str().c_str() );
		
		// CPU time
		beginInfoBox( 0.03f, 0.44f, 0.32f, 4, "CPU Time", fontMaterialRes, boxMaterialRes );
		
		// Frame time
		text.str( "" );
		text << frameTime << "ms";
		addInfoBoxRow( "Frame Total", text.str().c_str() );
		
		// Animation
		text.str( "" );
		text << animTime << "ms";
		addInfoBoxRow( "Animation", text.str().c_str() );

		// Geometry updates
		text.str( "" );
		text << geoUpdateTime << "ms";
		addInfoBoxRow( "Geo Updates", text.str().c_str() );

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

示例4: main

int main(int argc, char* argv[]) 
{
	heartbeats=256;                 
	ecgsample=256;               
	internalsample=256;
	amplitudenoise=0.0;          
	heart_rate_mean=60.0;        
	heart_rate_std=1.0;          
	lowfreq=0.1;             
	highfreq=0.25;           
	lowfreqstd=0.01;         
	highfreqstd=0.01;        
	lfhfradio=0.5; 

	if (!parse_args_pub_ecg(argc,argv,hostip,port,domainid,deviceid,loginfo,logdata,logconfpath,heartbeats,ecgsample,internalsample,
amplitudenoise,heart_rate_mean,heart_rate_std,lowfreq,highfreq,lowfreqstd,highfreqstd,lfhfradio))
    	return 1;
	
	/*Importing log4cpp configuration and Creating category*/
	log4cpp::Category &log_root = log4cpp::Category::getRoot();
    	log4cpp::Category &bloodInfo = log4cpp::Category::getInstance( std::string(loginfo));
    	log4cpp::Category &bloodData = log4cpp::Category::getInstance( std::string(logdata));
	log4cpp::PropertyConfigurator::configure(logconfpath);
	bloodInfo.notice(" ecg Publisher Started "+deviceid);
	
	/*Initializing SimpleDDS library*/
	SimpleDDS *simpledds;
	ECGTypeSupport_var typesupport;
	DataWriter_ptr writer;
	ECGDataWriter_var ecgWriter;


	simpledds = new SimpleDDS();
	typesupport = new ECGTypeSupport();
	writer = simpledds->publish(typesupport);
	ecgWriter = ECGDataWriter::_narrow(writer);
	hostInfo = gethostbyname(hostip.c_str());

	/*Initializing Socket Data*/
	if (hostInfo == NULL) 
	{
		bloodInfo.error(" Problem interpreting By HostInfo");
		bloodInfo.notice(" ecg Publisher Ends");	
		//exit(1);
	}
	serverPort=port;
	cin.get(c); 
	socketDescriptor = socket(AF_INET, SOCK_STREAM, 0);
	if (socketDescriptor < 0) 
	{
		bloodInfo.error(" Not able create the Socket");
		bloodInfo.notice(" ecg Publisher Ends");	
		//exit(1);
	}
	serverAddress.sin_family = hostInfo->h_addrtype;
	memcpy((char *) &serverAddress.sin_addr.s_addr,hostInfo->h_addr_list[0], hostInfo->h_length);
	serverAddress.sin_port = htons(serverPort);

	/*Binding Socket with Server Data Generator*/
	if (connect(socketDescriptor,(struct sockaddr *) &serverAddress,sizeof(serverAddress)) < 0) 
	{
		bloodInfo.error(" cannot connect with server");
		bloodInfo.notice(" ecg Publisher Ends at ");
		//exit(1);
	}

	/*Sending Commmand to The Data Generator*/
	datacommand<<"ECG"<<SEMI<<heartbeats<<SEMI<<ecgsample<<SEMI<<internalsample<<SEMI<<amplitudenoise;
	datacommand<<SEMI<<heart_rate_mean<<SEMI<<heart_rate_std<<SEMI<<lowfreq<<SEMI<<highfreq<<SEMI<<lowfreqstd<<SEMI<<highfreqstd<<SEMI<<lfhfradio;
	strcpy(buf,datacommand.str().c_str());
	if (send(socketDescriptor, buf, strlen(buf) + 1, 0) < 0)
	{
		bloodInfo.error(" Not able to send data");
		close(socketDescriptor);
		bloodInfo.notice(" ecg Publisher Ends");
		//exit(1);
	}

	flag=0;
	ECG data;

	/*Storing Domain and Device ID*/
	data.deviceID = DDS::string_dup(deviceid.c_str());
	data.deviceDomain = DDS::string_dup(domainid.c_str());
	bloodInfo.notice("ecg Started Publishing Data In DDS");
	bloodInfo.notice("Format: DOMAIN, DEVICEID, TIMEOFMEASURED, TimeInSeconds, AmplitudeMillivolts, WaveformPeak, StandardDeviation, Signal");	
	long count=0;
	while (1) 
	{
		
		if ((sizebuf=recv(socketDescriptor, buf, 1024,  MSG_NOSIGNAL)) > 0) 
		{
			cout<<"\n"<<buf;
			buf[sizebuf]='\0';
			string datasplit[7];
			datasplit[0] = strtok (buf,SEMI);
			datasplit[1] = strtok (NULL,SEMI);
			datasplit[2] = strtok (NULL,SEMI);
			datasplit[3] = strtok (NULL,SEMI);
			datasplit[4] = strtok (NULL,SEMI);
//.........这里部分代码省略.........
开发者ID:netspective,项目名称:fluent,代码行数:101,代码来源:ECG-pub.cpp

示例5: forwardpacket

void forwardpacket(string response) {
	// It's going to either be a linkstatepacket, tracepacket, or ackpacket
	vector<string> packParts = explode(" ", response);
	string type = packParts[0];
	Socket sock = Socket();
	if(type.compare("T") == 0) {
		// trace packet
		
	} else if(type.compare("A") == 0) {
		// ack packet - we know one of our neighbors is online. Should only occur when we run createroutes.
		HSPacket ack = HSPacket(response);
		
		// Debugging information
		stringstream write;
		write << "Recieved ack packet from: " << ack.sourceIP() << " on port: " << ack.sourcePort();
		cout << colorize(write.str(), "green");
		
		string destIP = ack.sourceIP();
		int destPort = ack.sourcePort();
		
		HSPacket response = HSPacket().type('R').sourceIP(host).sourcePort(port).destinationIP(destIP).destinationPort(destPort);
		
		sock.send(destIP, destPort, response.toString());
		
		// Used to create reliable transfer
		sequenceNumber++;
		
	} else if(type.compare("R") == 0) {
		// Here's we're getting responses from acks
		HSPacket r = HSPacket(response);
		
		// Debugging information
		debug << "Recieved response packet from: " << r.sourceIP() << " on port: " << r.sourcePort();
		cout << colorize(debug.str(), "red");
		debug.str("");
		
		// Always enable in topology if we got a response packet.
		topology.enable(r.sourceIP(), r.sourcePort());
		
		string ackFromIP = r.sourceIP();
		int ackWithPort = r.sourcePort();
		
		stringstream ss;
		// Remove them from acksNeededFromNeighbors

		for(unsigned int i = 0; i < acksNeededFromNeighbors.size(); i++) {
			Node n = acksNeededFromNeighbors.at(i);
			if(ackFromIP.compare(n.host()) == 0 && ackWithPort == n.port()) {
				acksNeededFromNeighbors.erase(acksNeededFromNeighbors.begin()+i);
				ss.str("");
				ss << "A|" << n.host() << ":" << n.port();
				ackTimer.remove(ss.str());
			}
		}
		
		if(acksNeededFromNeighbors.empty()) {
			ackTimer = Timer();
			// cout << "No more acks needed from neighbors! " << endl;
			// We got all our acks no need to disable a node in our topology. or send in the fire squad (ie. run createroutes)
		}
	} 
	else {
		// Should be a linkstatepacket - forward it on to all neighbors EXCEPT the one we recieved it from
		// After its sent out we should start receiving ack packets from our neighbors
		LSPacket LSP = LSPacket(response);
		
		// Check to see if we should update our topology and send out LSPs and whatnot, by comparing sequence numbers
		// Also will not forward on packets when TTL reaches 0 - this will prevent a buildup of packets in the network.
		if(!shouldUpdate(LSP)) return;
		
		stringstream write;
		write << "Recieved an LSP Packet from " << LSP.id() << " with a TTL of " << LSP.TTL() << " and a seqNo of " << LSP.sequenceNumber();
		
		cout << colorize(write.str(), "pink");
		
		vector<Node> neighbors = topology.neighborsFromString(LSP.neighbors());
		
		// cout << "Disabled: " << disabled.at(0).host() << " Port: " << disabled.at(0).port() << endl;
		
		// Update the topology
		for(unsigned int i = 0; i < neighbors.size(); i++) {
			Node neighbor = neighbors.at(i);
			neighbor = topology.get(neighbor);
			if(neighbor.online()) {
				topology.enable(neighbor.host(), neighbor.port());
			} else {
				topology.disable(neighbor.host(), neighbor.port());
			}
		}
		
		// Decrement the TTL;
		int TTL = LSP.TTL();
		TTL--;
		
		// Forward LSP packet to all neighbors except the one we just received from
		string ID = LSP.id();
		map<string, string> IDInfo = fromID(ID);
		string host = IDInfo["host"];
		int port = atoi(IDInfo["port"].c_str());
		
//.........这里部分代码省略.........
开发者ID:matthewmueller,项目名称:Networking-Assignment-3,代码行数:101,代码来源:emulator.cpp

示例6: ClearRawMongoProgramOutput

 BSONObj ClearRawMongoProgramOutput( const BSONObj &args ) {
     mongo::mutex::scoped_lock lk( mongoProgramOutputMutex );
     mongoProgramOutput_.str( "" );
     return undefined_;
 }
开发者ID:mattinsler,项目名称:mongo,代码行数:5,代码来源:shell_utils.cpp

示例7: error

void KsLcsReader::error(const stringstream &msg)
{
	cout<<msg.str()<<endl;
}
开发者ID:nykma,项目名称:ykt4sungard,代码行数:4,代码来源:readlcs.cpp

示例8: drawSquare

void drawSquare(int pos, board_2048& b) {
	/* Initialize colors for nCurses use */
	init_pair(1, COLOR_WHITE, COLOR_BLACK);
	init_pair(2, COLOR_CYAN, COLOR_RED);
	init_pair(3, COLOR_MAGENTA, COLOR_GREEN);
	init_pair(4, COLOR_BLUE, COLOR_YELLOW);
	init_pair(5, COLOR_YELLOW, COLOR_BLUE);
	init_pair(6, COLOR_GREEN, COLOR_MAGENTA);
	init_pair(7, COLOR_RED, COLOR_CYAN);
	init_pair(8, COLOR_BLACK, COLOR_WHITE);
	init_pair(9, COLOR_CYAN, COLOR_MAGENTA);
	init_pair(10, COLOR_MAGENTA, COLOR_BLUE);
	init_pair(11, COLOR_BLUE, COLOR_GREEN);
	init_pair(12, COLOR_GREEN, COLOR_RED);
	init_pair(13, COLOR_RED, COLOR_BLACK);
	init_pair(14, COLOR_MAGENTA, COLOR_CYAN);
	init_pair(15, COLOR_BLUE, COLOR_MAGENTA);
	init_pair(16, COLOR_GREEN, COLOR_BLUE);


	// Find upper left corner
	int y = y_0 + squareHeight * (pos / 4) + 1;
	int x = x_0 + squareWidth * (pos % 4);

	ss.str("");
	if (b.getVal(pos) == 0) {	// Draw empty square
		move(y,x + 1);
		addstr( EMPTY_STRING );
		move(y + 1, x + 1);
		addstr( EMPTY_STRING );
		move(y - 1, x + 1);
		addstr( EMPTY_STRING );
	}
	else{	// Not empty
		int colorPairValue = (int) (log(b.getVal(pos)) / log(2));
		if (colorPairValue < 0 || colorPairValue > 16) colorPairValue = 0;
		if (b.getVal(pos) > 0 ) {
			attron(COLOR_PAIR( (colorPairValue % 16) + 1) );
		}
		ss << b.getVal(pos);
		int length = ss.str().length();
		int diff = (squareWidth - length)/2;

		// Clear square to color
		move(y,x + 1);
		addstr( EMPTY_STRING );
		move(y + 1, x + 1);
		addstr( EMPTY_STRING );
		move(y - 1, x + 1);
		addstr( EMPTY_STRING );
		move(y, x + 1);
		for (int i = 0; i < diff - 1; i++)
		addch(' ');

		addstr( (ss.str()).c_str() );

		for (int i = 0; i < diff - 1; i++)
		addch(' ');
		if (b.getVal(pos) > 0 ) {
			attroff(COLOR_PAIR( (colorPairValue % 16) + 1) );
		}
	}
}
开发者ID:bkushigian,项目名称:2048,代码行数:63,代码来源:boardDriver.cpp

示例9: main

int main()
{	
	LUT(relationLUT);

	keepcolors("SegmentColors.txt");
	createHash("ColorQuantas.txt");

	myData.getTrainData("train.txt");
	myData.getTestData("test.txt");

	char choice;
	cout << "want to train svm? (Y//N)" << endl;
	cin >> choice;

	if (choice == 'y' || choice == 'Y'){

		int trainnumber;
		cout << "enter number for saving:" << endl;
		cin >> trainnumber;
	
		cout << "Number of train samples:" << endl;
		cin >> train_sample_number;
		do{
			hesapla(myData.trainArr[index][0], myData.trainArr[index][1], myData.labelsArr[index]);
			index = index + 1;


		} while (index<train_sample_number);

		
		Mat labelsMat(train_sample_number, 1, CV_32FC1, labels_array);
		Mat trainingDataMat(train_sample_number, numberofbins, CV_32FC1, trainingData);


		// Set up SVM's parameters
		CvSVMParams params;
		params.svm_type = CvSVM::C_SVC;
		params.kernel_type = CvSVM::LINEAR;
		params.term_crit = cvTermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);

		// Train the SVM
		CvSVM SVM;
		SVM.train(trainingDataMat, labelsMat, Mat(), Mat(), params);
		//SVM.train_auto(trainingDataMat,labelsMat,Mat(),Mat(),params);

		mysvmstream << svmfile << trainnumber << xmltype;
		string mysvmfilename = mysvmstream.str();
		const char *cstrs = mysvmfilename.c_str();
		SVM.save(cstrs);
		
		cout << "Number of test samples:" << endl;
		cin >> test_sample_number;
		do{
			testyapilk(myData.testArr[sindex][0], myData.testArr[sindex][1]);
			sindex = sindex + 1;

		} while (sindex<test_sample_number);

		Mat testing_data = Mat(test_sample_number, numberofbins, CV_32FC1, samples);
		Mat testing_classifications = Mat(test_sample_number, 1, CV_32FC1);
		SVM.predict(testing_data, testing_classifications);
		cout << testing_classifications << endl;

	
	}
开发者ID:gokceerdem,项目名称:train_s,代码行数:65,代码来源:train_svm.cpp

示例10: PrintLatexStats


//.........这里部分代码省略.........
			file << KDGetNumberOfSplits() << " & " << KDGetNumberOfAxises() << " & ";
			file << scene->frustumdim << " & " << scene->frustumstepsize << " & " << scene->frustumstep;

		
			file << "\\\\ \\hline" << endl;
			file << endl;

			file << "\\hline" << endl;
			file << "\\end{tabular}" << endl;

			file << "\\subsubsection{Målinger}" << endl;
			file << "\\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \\hline " << endl;
			file << " & FPS & MPT & TUP & ALS & LHP & LPR & APT & FHP & DEP & AEP \\\\ \\hline" << endl;


			kernel_stats << "\\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \\hline \n";
			kernel_stats << " & Transform & KDBuild & RayGen & Travers & PolyPartition & PolyTest & Total \\\\ \\hline \n";


		}

		file.precision(2);

		file << "Frame " << frame << " & "; 
		file << (float)(1000.0f) / (float)(rendertime) << " & ";
		file << (scene->npolytests)/ 1000000.0f << " & ";
		file << opt_rendertime*100 / rendertime << "\\% & ";
		file << als << " & ";
		file << (scene->nleafhits*100)/ ( imgbuf->GetWidth() * imgbuf->GetHeight()) << "\\% & ";
		file << (float)apt/(float)als << " & ";
		file << apt << " & ";
		file << fhp << "\\% & ";
		file << scene->frustum_dep << " & ";printf("Total\n");
		printf("\tThreads: %i\n", args.nthreads); 
		printf("\tJobs   : %i\n\n", args.njobs);  
		printf("\tFPS    : %.2f - %.2f\n", stats.min_fps, stats.max_fps);
		printf("\tMPT    : %.2f - %.2f\n", stats.min_mpt, stats.max_mpt);
		printf("\tTUP    : %g%% - %g%%\n", stats.min_tup, stats.max_tup);
		printf("\tALS    : %i - %i\n", stats.min_als, stats.max_als);
		printf("\tLHP    : %i%% - %i%%\n", stats.min_lhp, stats.max_lhp);
		printf("\tLPR    : %.2g - %.2g\n", stats.min_lpr, stats.max_lpr);
		printf("\tAPT    : %i - %i\n", stats.min_apt, stats.max_apt);
		printf("\tFHP    : %i%% - %i%%\n", stats.min_fhp, stats.max_fhp);
		printf("\tDEP    : %i - %i\n", stats.min_dep, stats.max_dep);
		printf("\tAEP    : %.2g - %.2g\n\n", stats.min_aep, stats.max_aep);

		printf("\tTT     : %i - %i ms\n", stats.min_tt, stats.max_tt);
		printf("\tKDB    : %i - %i ms\n", stats.min_kdb, stats.max_kdb);
		printf("\tRG     : %i - %i ms\n", stats.min_rg, stats.max_rg);
		printf("\tKDT    : %i - %i ms\n", stats.min_kdt, stats.max_kdt);
		printf("\tPP     : %i - %i ms\n", stats.min_pp, stats.max_pp);
		printf("\tPT     : %i - %i ms\n", stats.min_pt, stats.max_pt);
		file << aep;
		file << "\\\\ \\hline" << endl;

	

		if(frame > 0)
		{
			kernel_stats.precision(2);

			kernel_stats << "Frame " << frame << " & ";
			kernel_stats << scene->transform_time << " ms & ";
			kernel_stats << scene->kdbuild_time << " ms & ";
			kernel_stats << scene->raygen_time << " ms & ";
			kernel_stats << scene->kdtravers_time << " ms & ";
			kernel_stats << scene->polypartition_time << " ms & ";
			kernel_stats << scene->polytest_time << " ms & ";
			kernel_stats << (scene->transform_time + scene->kdbuild_time + scene->raygen_time + scene->kdtravers_time + scene->polypartition_time + scene->polytest_time) << " ms "; 
			kernel_stats << " \\\\ \\hline\n";


		}
	}

	
	if(args.printstats && frame == 25)
	{

		file << "\\end{tabular}" << endl;

		kernel_stats << "\\end{tabular} \n";


		file << "\\\\ \\ \\\\ \\ \\\\ \\ \\\\\n" << kernel_stats.str();

		file << "\\normalsize" << endl;

		file << "\\end{document}" << endl;
		
		file.close();

		cout << "Done writing stats.tex" << endl;
	}





}
开发者ID:lukaszdk,项目名称:lzrt,代码行数:101,代码来源:main.cpp

示例11: drawBoard

/* draw the board. Appeals to global variables to determine manner to do this
 * (ncurses or otherwise) */
void drawBoard(board_2048& b) {
	if (usingCurses){
		move(score_y, score_x);
		/* Draw the scoreboard */
		ss.str("");
		ss << b.getScore() << "   WINS: " << wins << "     ";
		init_pair(1, COLOR_RED, COLOR_BLACK);
		attron(COLOR_PAIR(1));
		addstr( "SCORE: " );
		addstr( (ss.str()).c_str());
		// Add High Score
		ss.str("");
		ss << "HIGHSCORE: "<<  highScore << "   " << "AVERAGE: ";
		if (gameNumber > 1) ss <<  cummulativeScore/(gameNumber - 1);
		else ss << 0;
		ss << "        ";
		move(score_y + 1, score_x);
		addstr( ss.str().c_str());

		// Add GAme Number
		ss.str("");

		ss << "GAME " << gameNumber << " OF " << numberOfGames << "  ";
		move(score_y + 2, score_x);
		addstr(ss.str().c_str());

		// Draw Border
		// Horizontal Lines
		attroff(COLOR_PAIR(1));
		for (int j = 0; j < 5; j++) {
			move(y_0 - 1 + squareHeight*j, x_0);
			for (int i = 0; i < 4 * squareWidth; i++ )
			if ( i % squareWidth == 0) {
				if (j == 0) addch(ACS_TTEE);
				else if (j == 4) addch(ACS_BTEE);
				else addch(ACS_HLINE);
			}
			else
			addch(ACS_HLINE);
		}
		// Vertical Lines
		for (int j = 0; j < 4*squareHeight; j++) {
			for (int i = 0; i < 5; i++){
				move(y_0 + j, x_0 + i * squareWidth);
				if (j % squareHeight == squareHeight - 1) {
					if (i == 0) addch(ACS_LTEE);
					else if (i == 4) addch(ACS_RTEE);
					else addch(ACS_PLUS);
				}
				else
				addch(ACS_VLINE);
			}
		}
		// Draw Corners
		move(y_0 - 1, x_0);
		addch(ACS_ULCORNER);
		move(y_0 - 1, x_0 + 4*squareWidth);
		addch(ACS_URCORNER);
		move(y_0 + 4*squareHeight - 1, x_0);
		addch(ACS_LLCORNER);
		move(y_0 + 4*squareHeight - 1, x_0 + 4 * squareWidth);
		addch(ACS_LRCORNER);

		for (int i = 0; i < 16; i++) {
			drawSquare(i, b);
		}
		move(HEIGHT, WIDTH);
	} // if using curses
	else { // no curses
		for (int i = 0; i < 16; i++) {
			cout.width(7);
			cout << b.getVal(i);
			cout.width(1);
			cout << " | ";
			if (i % 4 == 3)
			cout << '\n';
		}
	} // no curses
}
开发者ID:bkushigian,项目名称:2048,代码行数:81,代码来源:boardDriver.cpp

示例12: if

				case 5: mySR = "Bt"; break;
				case 6: mySR = "Cm"; break;
				case 7: mySR = "Ct"; break;
				case 8: mySR = "Dm"; break;
				case 9: mySR = "Dt"; break;
				case 10: mySR = "El"; break;
				case 11: mySR = "Em"; break;
				case 12: mySR = "Et"; break;
				default: mySR = ; break;
				}
			}	
		}
		else if (opti == 2) {
			stringstream sfID;
			sfID << fID;
			mySR = "E" + sfID.str();
		}
		else if (opti == 3) {
			stringstream sfID;
			sfID << fID;
			mySR = "D" + sfID.str();
		}

		int label = 1; // 0 - no label, 1 - SR, 2 - CLsexp, 3 - PAPER SR + CLs for new SR
		if (label == 0) {
			cout << "No label!" << endl;
		} else if (label == 1) {
			lat.DrawLatex(mH1sq,m12,mySR.Data());
			//cout << mH1sq << " " << m12 << " " << mySR.Data() << endl;
		} else if (label == 2) {
			stringstream sCLsexp;
开发者ID:lawrenceleejr,项目名称:ZeroLeptonAnalysis,代码行数:31,代码来源:SUSY_mgl_vs_msq_all_withBand_cls_blind_forNUHMG.C

示例13: ScanFile

void ScanFile(string path)
{
    cout << path << endl;
    //system("pause");
    //cout << path << endl;
    //cin.get();

    string line_read;
    stringstream line_write_ss;
    string line_write;
    string Quote_author;
    bool duplicate;
    unsigned long tempfile_size;

    string line;
    string feld;
    unsigned int line_pos=0;
    unsigned short feld_pos=0;

    vector<int> Pos(7);
    int i;

    char infile_char;

    infile_ScanFile.open(path, ios::in|ios::binary);
    if (infile_ScanFile.is_open()) {

        unsigned int aaa=0;
        unsigned int bbb=0;

        /*
        while (infile_ScanFile.get(infile_char))
        {
            aaa++;
            if(aaa==1)
            {
                aaa=0;
                bbb++;
                cout << infile_char;
            }
        }
        system("pause");
        */

        while (infile_ScanFile.get(infile_char))
        {
            if(infile_char==Find[0][Pos[0]])
            {
                Pos[0]++;
            } else {
                Pos[0]=0;
            }
            if(Pos[0]==Find_length[0]) break;
        }

            //
        //}

        while(1)
        {
            //cout << line << endl;
            //memset(line,0,sizeof(line));
            feld_pos=0;
            line.clear();
            feld.clear();
            //infile_ScanFile.get(infile_char);
            while(infile_ScanFile.get(infile_char))
            {
                //cout << aaa++ << endl;
                //continue;
                //cout << "#";
                //cout << infile_char;
                line.push_back(infile_char);
                if(infile_char=='\n') break;
                //new_feld:;
                if(infile_char==' ')
                {
                    infile_ScanFile.get(infile_char);
                    line.push_back(infile_char);
                    if(infile_char=='\'')
                    {
                        infile_ScanFile.get(infile_char);
                        line.push_back(infile_char);
                        if(infile_char=='\'') continue;

                        //memset(hash_char,0,sizeof(hash_char));
                        if(feld_pos==1)
                        {
                            while(1)
                        {
                            //cout << infile_char;
                            //cout << "#";
                            if(infile_char=='\'')
                            {
                                infile_char_finchar_1:;
                                infile_ScanFile.get(infile_char);
                                line.push_back(infile_char);
                                if(infile_char==',')
                                {
                                    //infile_ScanFile.get(infile_char);
//.........这里部分代码省略.........
开发者ID:nicoboss,项目名称:KickassCopy,代码行数:101,代码来源:main.cpp

示例14: write_msg

 void write_msg()
 {
     m_msg << endl;
     CHECK_MESSAGE( m_msg.str() );
 }
开发者ID:lenmus,项目名称:lenmus,代码行数:5,代码来源:lenmus_test_score_corrector.cpp

示例15: check_events

void cScreenGangs::check_events()
{
	if (g_InterfaceEvents.GetNumEvents() == 0) return;	// no events means we can go home
	if (g_InterfaceEvents.CheckButton(back_id))			// if it's the back button, pop the window off the stack and we're done
	{
		g_InitWin = true;
		g_WinManager.Pop();
		return;
	}
	if (g_InterfaceEvents.CheckButton(ganghire_id))
	{
		hire_recruitable();
		return;
	}
	if (g_InterfaceEvents.CheckButton(weaponup_id))
	{
		int cost = 0;
		int *wlev = g_Gangs.GetWeaponLevel();
		cost = tariff.goon_weapon_upgrade(*wlev);
		if (g_Gold.item_cost(cost) == true)
		{
			*wlev += 1;
			g_InitWin = true;
		}
		wlev = 0;
		return;
	}

	int buynets = 0;
	if (g_InterfaceEvents.CheckButton(netbuy_id))	buynets = 1;
	if (g_InterfaceEvents.CheckButton(netbuy10_id))	buynets = 10;
	if (g_InterfaceEvents.CheckButton(netbuy20_id))	buynets = 20;
	if (buynets > 0)
	{
		int cost = 0;
		int amount = buynets;
		int *nets = g_Gangs.GetNets();
		if (((*nets) + buynets) > 60) amount = 60 - (*nets);
		cost = tariff.nets_price(amount);
		if (g_Gold.item_cost(cost) == true)
		{
			*nets += amount;
			if (IsCheckboxOn(netautobuy_id)) g_Gangs.KeepNetStocked(*nets);
			g_InitWin = true;
		}
		nets = 0;
		buynets = 0;
		return;
	}

	int buypots = 0;
	if (g_InterfaceEvents.CheckButton(healbuy_id))		buypots = 1;
	if (g_InterfaceEvents.CheckButton(healbuy10_id))	buypots = 10;
	if (g_InterfaceEvents.CheckButton(healbuy20_id))	buypots = 20;
	if (buypots > 0)
	{
		int cost = 0;
		int amount = buypots;
		int *potions = g_Gangs.GetHealingPotions();
		if (((*potions) + buypots) > 200)	amount = 200 - (*potions);
		cost = tariff.healing_price(amount);
		if (g_Gold.item_cost(cost) == true)
		{
			*potions += amount;
			if (IsCheckboxOn(healautobuy_id)) g_Gangs.KeepHealStocked(*potions);
			g_InitWin = true;
		}
		potions = 0;
		buypots = 0;
		return;
	}
	if (g_InterfaceEvents.CheckCheckbox(netautobuy_id))
	{
		int *nets = g_Gangs.GetNets();
		g_Gangs.KeepNetStocked(IsCheckboxOn(netautobuy_id) ? *nets : 0);
	}
	if (g_InterfaceEvents.CheckCheckbox(healautobuy_id))
	{
		int *potions = g_Gangs.GetHealingPotions();
		g_Gangs.KeepHealStocked(IsCheckboxOn(healautobuy_id) ? *potions : 0);
	}
	if (g_InterfaceEvents.CheckButton(gangfire_id))
	{
		selection = GetLastSelectedItemFromList(ganglist_id);
		if (selection != -1)
		{
			g_Gangs.FireGang(selection);
			g_InitWin = true;
		}
		return;
	}
	if (g_InterfaceEvents.CheckListbox(recruitlist_id))
	{
		string ClickedHeader = HeaderClicked(recruitlist_id);
		if (ClickedHeader != "")
		{
			g_LogFile.ss() << "User clicked \"" << ClickedHeader << "\" column header on Recruit listbox" << endl; g_LogFile.ssend();
			return;
		}

//.........这里部分代码省略.........
开发者ID:mjsmagalhaes,项目名称:crazys-wm-mod,代码行数:101,代码来源:cScreenGangs.cpp


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