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


C++ printStatus函数代码示例

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


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

示例1: main

int main ()
{
	TrafficLight l = TL_Off;

	printStatus( l );
	printf( "Press any key to enable traffic..." );
	getchar();

	l  = TL_Red;

	while ( true )
	{
		printStatus( l );

		printf( "Input 'q' to quit, 'e' to turn on/off, 'b' to toggle blinking mode, any other key for next state\n" );
		switch ( getchar() )
		{
			case 'q':
				return 0;

			case 'e':
				l = ( l == TL_Off ) ? TL_Yellow : TL_Off;
				break;

			case 'b':
				l = ( l == TL_Off ) ? TL_Off : ( ( l == TL_YellowBlinking ) ? TL_Yellow : TL_YellowBlinking );
				break;

			default:
				l = nextTrafficLight( l );
				break;
		}
	}
}
开发者ID:zaychenko-sergei,项目名称:cpp_intro,代码行数:34,代码来源:traffic_light_controller.cpp

示例2: waitTimeout

static void waitTimeout(niport *pniport,double seconds)
{
    epicsEventWaitStatus status;
    transferState_t saveState;

    if(seconds<0.0) {
        status = epicsEventWait(pniport->waitForInterrupt);
    } else {
        status = epicsEventWaitWithTimeout(pniport->waitForInterrupt,seconds);
    }
    if(status==epicsEventWaitOK) return;
    saveState = pniport->transferState;
    pniport->transferState = transferStateIdle;
    switch(saveState) {
    case transferStateRead:
        pniport->status=asynTimeout;
        printStatus(pniport,"waitTimeout transferStateRead\n");
        break;
    case transferStateWrite:
        pniport->status=asynTimeout;
        printStatus(pniport,"waitTimeout transferStateWrite\n");
        break;
    case transferStateCmd:
        pniport->status=asynTimeout;
        printStatus(pniport,"waitTimeout transferStateCmd\n");
        break;
    default:
        pniport->status=asynTimeout;
        printStatus(pniport,"waitTimeout transferState ?\n");
    }
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:31,代码来源:drvNi1014.c

示例3: checkSuperInvaderHit

/* Function that will determine whether an Super Invader has been hit by player's missile */
int checkSuperInvaderHit(){
    for (int k = 0; k<5; k++) {
	/* Rememeber Super Invaders are 5 chars long, so need to determine where the player's missile hit the invader */
        if ((p.missileX == (superInvader.posX)) && ((p.missileY == (superInvader.posY+k)))) {
            mvprintw(superInvader.posX, superInvader.posY, "     ");  /* go back 5 spaces on the Y and delete the super invader*/
            superInvader.alive = 0;   /* super invader has been defeated */
            score += 500 * level;     /* add a score of 500 with regards to the current level */
            updateScore();	      /* pass this new score into the updateScore() function in player.c */

	    /* Switch statement that will prompt 'encouraging' messages to the user */
            switch(rand()%3){
                case 0:
                    printStatus("Earth 1 Aliens 0!!!!!!!!!");
                    break;
                case 1:
                    printStatus("Thats the way to gooooo!!!!!!!");
                    break;
                case 2:
                    printStatus("We will destroy them, bravoooo !!!!");
                    break;
                }
            return 1; /* boolean for Super Invader has been hit */
        }
    }
    return 0;
}
开发者ID:RobAntro,项目名称:SpaceInvaders,代码行数:27,代码来源:invader.c

示例4: genCode

void genCode()
{
	printProc("Generating code... ");
	printStatus("DONE",10);
	printProc("Writing on file... ");
	printStatus("DONE",10);
	writeHeader();
	int i, k;
	for(i=1; i<=charCount; i++)
	{
		k=mark[charSet[i]];
		while(k!=parent[k])
		{
			k=parent[k];
			if(k<0)
				k = -k, push(0);
			else
				push(1);
		}
		while((k=pop())> -1)
			writeOnFile(k);
	}
	if(dc<7)
	{
		for(i=dc+1; i<8; i++)
			s[i] = '0';
		toDec();
		fputc(7-dc+'0', fp);
	}
	else
	{
		fputc(0+'0', fp);
	}
	closeFile2Write();
}
开发者ID:AssaultKoder95,项目名称:codejam,代码行数:35,代码来源:Comp.cpp

示例5: dialog

void ExecutionListView::deleteRegex()
{
    CSMesBackgroundComputations::Pauser pauser;
    ExecutionListModel *model_p=_model();
    if (! model_p)
        return;
    WExecutionDelete dialog(csmes_p,this);
    if (dialog.exec())
    {
        ExecutionNames sources=dialog.sourceList();
        csmes_p->beginUndoGroup(tr("Delete executions '%1'").arg(dialog.source()));
        int sz=sources.size();
        for (int i=0; i<sz; i++)
        {
            printStatus(tr("Deleting '%1'...").arg(sources.at(i)),static_cast<float>(i)/static_cast<float>(sz));
            if (!model_p->deleteExecution(sources.at(i)))
            {
                if (QMessageBox::warning(this,tr("Error"),tr("Deleting '%1' not possible.").arg(sources.at(i)),
                                         QMessageBox::Abort, QMessageBox::Ignore)==QMessageBox::Abort)
                    break;
            }
        }
        csmes_p->endUndoGroup();
        printStatus("",-1);
    }
}
开发者ID:testcocoon,项目名称:testcocoon,代码行数:26,代码来源:ExecutionListView.cpp

示例6: checkInvaderHit

/* Function that will determine whether an invader has been hit by player's missile */
int checkInvaderHit(){
    for (int i = 0; i<INVADERS_ROWS; i++)
        for (int j = 0; j<INVADERS_COLUMNS; j++) {
            if (inv[i][j].alive) {
                for (int k = -1; k<2; k++) {
		    /* Remember invaders are 3 chars long, so need to determine where the player's missile hit the invader */
                    if ((p.missileX == (inv[i][j].posX)) && ((p.missileY == (inv[i][j].posY+k)))) {
                        mvprintw(inv[i][j].posX, inv[i][j].posY-1, "   ");  /* go back 3 spaces on the Y and delete the invader */
                        inv[i][j].alive = 0;  /* current invader has been defeated */
                        count--;	      /* number of invaders has been decreased */
                        score += 100 * level; /* add a score of 100 with regards to what level user is on */
                        updateScore();	      /* pass this new score into the updateScore() function in player.c */

			/* Switch statement that will prompt 'encouraging' messages to the user */
                        switch(rand()%3){
                            case 0:
                                printStatus("Great Shot! Just keep going.");
                                break;
                            case 1:
                                printStatus("Nuke them down, nuke them down!!!");
                                break;
                            case 2:
                                printStatus("Superb shot!!!");
                                break;
                        }
                        return 1; /* boolean for invader has been hit */
                    }
                }
            }
        }
    return 0;
}
开发者ID:RobAntro,项目名称:SpaceInvaders,代码行数:33,代码来源:invader.c

示例7: if

void MotionGraphController::iterateStatus()
{
	//transitions to follow
	if (path.size() > 0)
	{
		status.isTransitioning = true;
		// take the first one off the list;
		vertexTargets temp = path.front();
		path.pop_front();
		//first seq
		status.SeqID = temp.SeqID;
		//first seq framenumber where we transition 
		status.FrameNumberTransition = temp.FrameNumber;
		//what we are transitioning to
		status.TransitionToSeqId = temp.SeqID2;
		//what frame we are transitioning to on the second seq;
		status.FrameNumberTransitionTo = temp.FrameNumber2;
	}
	//let it play out
	else if (status.isTransitioning==true)
	{
		status.SeqID = status.TransitionToSeqId;
		status.FrameNumber = status.FrameNumberTransitionTo;
		status.FrameNumberTransition = returnMotionSequenceContainerFromID(status.SeqID).MS->numFrames();
		
		status.isTransitioning = false;
		printStatus();
	
	}// none left so repeat
	else
	{
			path = pathBackup;
		iterateStatus();
		printStatus();
		return;
		//status.isTransitioning = true;
		// the last transition is now the new seqId aka what is playing
		status.SeqID = status.TransitionToSeqId;
		//	MotionSequence *motion_sequence = returnMotionSequenceContainerFromID(status.SeqID).MS;
		//where to transition on the last frame
		//status.FrameNumberTransition = motion_sequence->numFrames();
		/// set transition to to fame 0 of the same motion sequence
		//status.FrameNumberTransitionTo = 0;
	}
	//iterate the motio

	



}
开发者ID:camcow,项目名称:SKAstart,代码行数:51,代码来源:MotionGraphController.cpp

示例8: clock

SequenceStatus GestureSeqRecorder::findActivation(Pose::Type gesture, ControlState state, commandData& response)
{
    SequenceStatus status = SequenceStatus::SUCCESS;
    sequenceList *seqList = (*seqMapPerMode)[state.getMode()];

    // Loop through all possible sequences in this mode, and activate any that
    // have a matching first gesture.
    for (sequenceList::iterator it = seqList->begin(); it != seqList->end(); it++)
    {
        if ((it->seq.size() >= 0) && 
            (it->seq.at(0).type == gesture))
        {
            clock_t now = clock();
            progressBaseTime = now;
            if (it->seq.at(0).poseLen == SeqElement::PoseLength::IMMEDIATE)
            {
                // Special case. Immediate isn't 'held'
                response = it->sequenceResponse;
                break;
            }

            // found sequence to activate!
            activeSequencesMutex.lock();
            activeSequences.push_back(&(*it));
            activeSequencesMutex.unlock();
            printStatus(true);

            holdGestTimer = REQ_HOLD_TIME; // set count on any progression
        }
    }

    seqList = NULL;
    return status;
}
开发者ID:FusionpipeSoftwareSolutions,项目名称:ProjectMidas,代码行数:34,代码来源:GestureSeqRecorder.cpp

示例9: initInjectorCentral

void initInjectorCentral(Logging *sharedLogger) {
	logger = sharedLogger;
	chThdCreateStatic(benchThreadStack, sizeof(benchThreadStack), NORMALPRIO, (tfunc_t) benchThread, NULL);

	for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
		is_injector_enabled[i] = true;
	}

	startInjectionPins();
	startIgnitionPins();

	printStatus();
	addConsoleActionII("injector", setInjectorEnabled);

	addConsoleAction("fuelpumpbench", fuelPumpBench);
	addConsoleActionS("fuelpumpbench2", fuelPumpBenchExt);
	addConsoleAction("fanbench", fanBench);

	addConsoleAction("milbench", milBench);
	addConsoleActionSSS("fuelbench", fuelbench);
	addConsoleActionSSS("sparkbench", sparkbench);

	addConsoleActionSSSSS("fuelbench2", fuelbench2);
	addConsoleActionSSSSS("sparkbench2", sparkbench2);
}
开发者ID:glocklueng,项目名称:rusefi,代码行数:25,代码来源:injector_central.cpp

示例10: printStatus

void StatusTestGenResNorm<Sacado::MP::Vector<StorageType>,MV,OP>::print(std::ostream& os, int indent) const
{
  for (int j = 0; j < indent; j ++)
    os << ' ';
  printStatus(os, status_);
  os << resFormStr();
  if (status_==Undefined)
    os << ", tol = " << tolerance_ << std::endl;
  else {
    os << std::endl;
    if(showMaxResNormOnly_ && curBlksz_ > 1) {
      const MagnitudeType maxRelRes = *std::max_element(
        testvector_.begin()+curLSIdx_[0],testvector_.begin()+curLSIdx_[curBlksz_-1]
        );
      for (int j = 0; j < indent + 13; j ++)
        os << ' ';
      os << "max{residual["<<curLSIdx_[0]<<"..."<<curLSIdx_[curBlksz_-1]<<"]} = " << maxRelRes
         << ( maxRelRes <= tolerance_ ? " <= " : " > " ) << tolerance_ << std::endl;
    }
    else {
      for ( int i=0; i<numrhs_; i++ ) {
        for (int j = 0; j < indent + 13; j ++)
          os << ' ';
        os << "residual [ " << i << " ] = " << testvector_[ i ];
        os << ((testvector_[i]<tolerance_) ? " < " : (testvector_[i]==tolerance_) ? " == " : (testvector_[i]>tolerance_) ? " > " : " "  ) << tolerance_ << std::endl;
      }
    }
  }
  os << std::endl;
}
开发者ID:agrippa,项目名称:Trilinos,代码行数:30,代码来源:Belos_StatusTest_GenResNorm_MP_Vector.hpp

示例11: main

int main() {
  	// Declares struct for screen coordinates
	struct scrCoord Scr;

	// Declares struct for commands
	struct Command Cmd;

	// Initializes variables
	Cmd.play = TRUE;
	Cmd.pu = FALSE;
	Cmd.colorPair = 1;
	Cmd.cmndIndex = -1;

	// Initializes screen
	initScreen(&Scr);

	while(Cmd.play) {
		// Prints coordinates and angle
		printStatus(&Scr);

		// Receives the command
		recCommand(&Scr, &Cmd);

		// Interprets command
		interpCommand(&Scr, &Cmd);
	}

	// Ends NCURSE screen
	endwin();
	
	return 0;
}
开发者ID:maxgomes92,项目名称:EADCoursesCodes,代码行数:32,代码来源:main.c

示例12: initInjectorCentral

void initInjectorCentral(void) {
	initLogging(&logger, "InjectorCentral");
	chThdCreateStatic(benchThreadStack, sizeof(benchThreadStack), NORMALPRIO, (tfunc_t) benchThread, NULL);

	for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
		is_injector_enabled[i] = true;
        }

	// todo: should we move this code closer to the injection logic?
	for (int i = 0; i < engineConfiguration->cylindersCount; i++) {
		io_pin_e pin = (io_pin_e) ((int) INJECTOR_1_OUTPUT + i);

		outputPinRegisterExt2(getPinName(pin), pin, boardConfiguration->injectionPins[i],
				&boardConfiguration->injectionPinMode);
	}

	printStatus();
	addConsoleActionII("injector", setInjectorEnabled);

	addConsoleActionII("fuelpumpbench", &fuelpumpbench);

	addConsoleActionSSS("fuelbench", &fuelbench);
	addConsoleActionSSS("sparkbench", &sparkbench);

	addConsoleActionSSSSS("fuelbench2", &fuelbench2);
	addConsoleActionSSSSS("sparkbench2", &sparkbench2);
}
开发者ID:ngocphu811,项目名称:rusefi,代码行数:27,代码来源:injector_central.cpp

示例13: loopCommandLine

void loopCommandLine(void) {
  // print status if we're not in the menu
  if (! menuEnabled) {
    if (TimerReached(&cmdline_looptime, 1000)) {
      printStatus();
    }
  } 
  // check for serial command
  unsigned int c = uart_getc();
  if (!(c & UART_NO_DATA)) {
    if (! menuEnabled) {
      menuEnabled=1;
      printHelp();
    }
    switch((char) c) {
      case 'x': case 'X':  // terminates menu
        uart_puts_P("Leaving menu." NEWLINESTR);
        menuEnabled=0; break;
      case 'b': case 'B':  // show PID values
        printPID(); break;
      case 'r': case 'R':  // reset PID values
        restorePIDDefault(); break;
      case 'o': case 'O':  // print out PID debug data
        togglePIDDebug(); break;
      case 'p':
        setPID_P(getPID_P() - delta); printPID(); break;
      case 'P':
        setPID_P(getPID_P() + delta); printPID();break;
      case 'i':
        setPID_I(getPID_I() - delta); printPID(); break;
      case 'I':
        setPID_I(getPID_I() + delta); printPID(); break;
      case 'd':
        setPID_D(getPID_D() - delta); printPID(); break;
      case 'D':
        setPID_D(getPID_D() + delta); printPID(); break;
      case 't':
        setPIDSetpoint(getPIDSetpoint() - delta); printPID(); break;
      case 'T':
        setPIDSetpoint(getPIDSetpoint() + delta); printPID(); break;
      case 's': case 'S':
        savePIDConfig(); break;
      case '+':  {// adjust delta
          delta *= 10.0; 
          if (delta > MAX_DELTA) delta = MAX_DELTA;
          uart_print_delta();
          break;
        }
      case '-':  {// adjust delta
          delta /= 10.0; 
          if (delta < MIN_DELTA) delta = MIN_DELTA;
          uart_print_delta();
          break;
        }

      case '?': // show menu
        printHelp(); break;
    }
  }
}
开发者ID:ChaosCoffeeControl,项目名称:CCC-PIDController,代码行数:60,代码来源:cmdline.c

示例14: dijkstra

void dijkstra(graph* G, long initial_node, char debug)
{
	long i,j,k;
	long aN; //actualNode
	G->D[initial_node] = 0;
	aN = initial_node;

	printf("Running dijkstra on graph\n");

	if(debug)
		printGraph(G);

	for(i = 0; i < G->N; i++)
	{
		G->visited[aN] = VISITED;

		if(debug){
			printf("It[%d] aN [%d]",i, aN); printStatus(G); printf("\n");
		}

		//Find all nodes connected to aN
		for(j=0;j<G->N;j++){
			if( (G->node[aN][j] != NO_CONN) ){
				if( (G->D[aN] + G->node[aN][j]) < G->D[j] ){
					G->D[j] = (G->D[aN] + G->node[aN][j]);
				}
			}
		}

		aN = getNextNode(G);
	}
	printf("Finished Dijkstra\n");
}
开发者ID:Saadia0220,项目名称:Dijkstra,代码行数:33,代码来源:dijkstra.c

示例15: printStatus

void XMOSControlPlugin::down(){
	printStatus(status, curLayer);
	switch(status){
		case SELECT_LAYER:
			curLayer=((curLayer)%XmosConfig::instance().numLayers())+1;
			break;
		case START_LAYER:
			XmosConfig::instance().stopLayer(curLayer);
			layerStarted[curLayer]=false;
			break;
		case ON_PERIOD:
			XmosConfig::instance().setOnPeriod(curLayer,XmosConfig::instance().getLayer(curLayer).getOnPeriod()-1);
			XmosConfig::instance().loadLayer(curLayer);
			break;
		case OFFSET:
			XmosConfig::instance().setOffset(curLayer,XmosConfig::instance().getLayer(curLayer).getOffset()-1);
			XmosConfig::instance().loadLayer(curLayer);
			break;
		case CYCLE:
			XmosConfig::instance().setCycleTime(curLayer,XmosConfig::instance().getLayer(curLayer).getCycleTime()-1);
			XmosConfig::instance().loadLayer(curLayer);
			break;
		case RUNNING:
			//ignore
			break;
	}
}
开发者ID:vladotrocol,项目名称:Bubbles,代码行数:27,代码来源:XMOSControlPlugin.cpp


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