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


C++ Loop函数代码示例

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


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

示例1: ShowUserByName

int ShowUserByName(int argc, char *argv[])
{
  struct mqelem *top;
  char buf[BUFSIZ];

  top = GetUserInfo(BY_NAME, argv[1], argv[2]);

  if (!top)		/* if there was an error then return. */
    return DM_NORMAL;

  if (!PromptWithDefault("Print full information, or just the names (f/n)?",
			 buf, 2, "f"))
    return DM_NORMAL;

  switch (buf[0])
    {
    case 'F':
    case 'f':
      Loop(top, PrintUserInfo);
      break;
    case 'N':
    case 'n':
      Loop(top, PrintUserName);
      break;
    }

  FreeQueue(top);
  return DM_NORMAL;
}
开发者ID:sipb,项目名称:athena-svn-mirror,代码行数:29,代码来源:user.c

示例2: Graph

int
D3DOverdrawWindow::
Graph(Array<t_edge>& Edge)
{
    m_iTested = 0;
    m_iRendered = 0;
    d3d->BeginScene();

    for (int i = 0; i < m_pClusterStart->GetSize() - 1; i++)
    {
        for (int j = i + 1; j < m_pClusterStart->GetSize() - 1 ; j++)
        {
            int cij = Loop(i, j);
            //debugf(("%d %d -> %d", i, j, cij));
            int cji = Loop(j, i);

            //debugf(("%d %d -> %d", j, i, cji));
            if (cij > cji)
            {
                t_edge e = {j, i, cij - cji};

                if (!Edge.PushBack(e))
                {
                    // out of memory
                    return 0;
                }

            }
            else if (cij < cji)
            {
                t_edge e = {i, j, cji - cij};

                if (!Edge.PushBack(e))
                {
                    // out of memory
                    return 0;
                }
            }
        }
    }

    debugf(("Fraction rendered: %f ", m_iRendered / (float)m_iTested));
    /*
    printf("p %d %d\n", m_pClusterStart->GetSize()-1, Edge.GetSize());
    for (int i = 0; i < Edge.GetSize(); i++)
        printf("a %d %d %d\n", Edge[i].from, Edge[i].to, Edge[i].cost);
    */
    d3d->EndScene();
    return 1;
}
开发者ID:TalanSoft,项目名称:amd-tootle,代码行数:50,代码来源:d3doverdrawwindow.cpp

示例3: Test_task

rtems_task Test_task(
  rtems_task_argument task_index
)
{
  uint32_t          cpu_num;
  char              name[5];
  char             *p;

  /* Get the task name */
  p = rtems_object_get_name( RTEMS_SELF, 5, name );
  rtems_test_assert( p != NULL );

   /* Get the CPU Number */
  cpu_num = rtems_smp_get_current_processor();

  /* Print that the task is up and running. */
  Loop();
  locked_printf(" CPU %" PRIu32 " running Task %s\n", cpu_num, name);

  /* Set the flag that the task is up and running */
  TaskRan[cpu_num] = true;


  /* Drop into a loop which will keep this task on
   * running on the cpu.
   */
  while(1);
}
开发者ID:chch1028,项目名称:rtems,代码行数:28,代码来源:tasks.c

示例4: ListByAdministrator

int ListByAdministrator(int argc, char **argv)
{
  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
  struct mqelem *top;

  type = strdup("USER");
  if (GetTypeFromUser("Type of member", "member", &type) == SUB_ERROR)
    return DM_NORMAL;

  sprintf(buf, "Name of %s", type);
  name = strdup(user);
  if (GetValueFromUser(buf, &name) == SUB_ERROR)
    return DM_NORMAL;

  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
    {
    case TRUE:
      sprintf(temp_buf, "R%s", type);	/* "USER" to "RUSER" etc. */
      free(type);
      type = strdup(temp_buf);
      break;
    case FALSE:
      break;
    default:
      return DM_NORMAL;
    }

  top = GetListInfo(ACE_USE, type, name);
  Loop(top, PrintListAce);

  FreeQueue(top);
  return DM_NORMAL;
}
开发者ID:sipb,项目名称:athena-svn-mirror,代码行数:33,代码来源:lists.c

示例5: SetPos

void CCrossDlg::SetInfo(const INFO& Info)
{
	SetPos(Info.Pos);
	SetSeconds(Info.Seconds);
	Loop(Info.Loop);
	SetWaveform(Info.Waveform);
}
开发者ID:fdiskcn,项目名称:Whorld,代码行数:7,代码来源:CrossDlg.cpp

示例6: ShowNFSService

int ShowNFSService(int argc, char **argv)
{
  int stat;
  struct mqelem *elem = NULL;
  char *args[10];

  if (!ValidName(argv[1]))
    return DM_NORMAL;

  args[0] = canonicalize_hostname(strdup(argv[1]));
  args[1] = strdup(DEFAULT_DIR);
  if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
    return DM_NORMAL;

  if ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, &elem)))
    com_err(program_name, stat, " in ShowNFSServices.");
  free(args[0]);
  free(args[1]);		/* prevents memory leaks. */

  elem = QueueTop(elem);
  Loop(elem, (void (*)(char **)) PrintNFSInfo);

  FreeQueue(elem);
  return DM_NORMAL;
}
开发者ID:sipb,项目名称:athena-svn-mirror,代码行数:25,代码来源:nfs.c

示例7: WindowLoop

void WindowLoop(void (*Loop)())
{
	struct timespec ts[3];
	int done = 0;
	XEvent event;

	clock_gettime(CLOCK_MONOTONIC, ts+2);
	ts[0] = ts[1] = ts[2];


	while(!done)
	{
    XQueryPointer(display, window, &window_returned,
         &window_returned, &root_x, &root_y, &win_x, &win_y,
         &mask_return);


    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		Loop();
		glXSwapBuffers(display, window);
		frame++;
		clock_gettime(CLOCK_MONOTONIC, ts+(frame%2));
		dtime = 1e-9*(ts[frame%2].tv_nsec - ts[!(frame%2)].tv_nsec) + (ts[frame%2].tv_sec - ts[!(frame%2)].tv_sec);
		ftime = 1e-9*(ts[frame%2].tv_nsec - ts[2].tv_nsec) + (ts[frame%2].tv_sec - ts[2].tv_sec);
	}

	//WindowKill(0);
}
开发者ID:krgn,项目名称:RootAnim,代码行数:30,代码来源:RootWindow.c

示例8: UserBySponsor

int UserBySponsor(int argc, char **argv)
{
  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
  struct mqelem *top;

  type = strdup("USER");
  if (GetTypeFromUser("Type of sponsor", "search_ace_type", &type) == SUB_ERROR)
    return DM_NORMAL;

  sprintf(buf, "Name of %s", type);
  name = strdup(user);
  if (GetValueFromUser(buf, &name) == SUB_ERROR)
    return DM_NORMAL;

  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
    {
    case TRUE:
      sprintf(temp_buf, "R%s", type);     /* "USER to "RUSER", etc. */
      free(type);
      type = strdup(temp_buf);
      break;
    case FALSE:
      break;
    default:
      return DM_NORMAL;
    }

  top = GetUserBySponsor(type, name);
  Loop(top, PrintLogin);

  FreeQueue(top);
  return DM_NORMAL;
}
开发者ID:sipb,项目名称:athena-svn-mirror,代码行数:33,代码来源:user.c

示例9: while

void Pong::Play(void)
{
	pixels[4*width+5] = 0;
	playing = true;
	while (playing)
		Loop();
}
开发者ID:zarac,项目名称:tgspu,代码行数:7,代码来源:Pong.cpp

示例10: main

int main(int argc, char* argv[])
{
	int sock; 

	if (argc < 3)
	{
		printf("usage: %s <ip addr> <port>\n",argv[0]);
		exit(1);
	}

	if (! SetupPrimesense() )
		return 1;

	if (! SetupBuffers() )
		return 1;

	sock = SetupClient(argv[1],argv[2]);
	
	GetTargetScreenSize(sock);
	
	Loop(sock);

	TeardownPrimesense();

	return 0;
}
开发者ID:Topographic0cean,项目名称:src,代码行数:26,代码来源:ImageFlinger.cpp

示例11: LoopB0

void LoopB0(TString cutconfig="newcutopt8"){

  TH1D* Loop(TTree*,double,double,int);
  TH1D* LoopGen(TTree*,double,double);
  
  TString infname_data="Original/testOriginal.root";

  TFile *inf_data = new TFile(infname_data.Data());
  
  TTree *nt_data = (TTree*) inf_data->Get("ntKstar");
    
  TH1D *hMass1=Loop(nt_data,10.,60.,1);
    
  TCanvas*canvas=new TCanvas("canvas","canvas",1000,500);
  canvas->Divide(3,1);
  canvas->cd(1);
  hMass1->Draw();
  canvas->SaveAs("canvasLoop.pdf");
  
  TFile*fB0output=new TFile(Form("ResultsLoopBzero/B0output_%s.root",cutconfig.Data()),"recreate");
  fB0output->cd();
  hMass1->SetName("hMass1");
  hMass1->Write();
  fB0output->Close();

}
开发者ID:ginnocen,项目名称:TestImprovingLoopBmesons,代码行数:26,代码来源:LoopB0.C

示例12: InitGeometry

int SDLWin::Run()
{
	WM->CreateSDLWindow();										// Initialize SDL
	WM->InitOpenGL();											// Initialize OpenGL
	Game->InitResources();
	Game->Pause();												// Switch to Menu Mode
	WM->GetRenderer()->Init();									// Initialize Renderer
	InitGeometry();												// Create Menus
	InitTextures();												// Initialize Menu Textures
	WM->GetRenderer()->To2D();									// Switch to 2D Rendering

    SDL_Event Event;											// Create an event variable for catching events that SDL sends
    while(WM->IsRunning())									// Main Loop starts here
    {
        if(SDL_PollEvent(&Event)) {
			GEM->ProcessEvent(&Event);				// Send Events to the 'Events' function for processing
        }
		if(WM->IsActive())
		{
			Loop();						// Game loop processing
			Render();					// Draw to the screen
			_CrtCheckMemory( );
		}
		SDL_Delay(TimeLeft());			// Limit the frame rate
    }

    Cleanup();							// Once everything is done, make sure to clean up all loose ends
    return 1;							// Return 1 so that we know everything went fine
}
开发者ID:Rocks25,项目名称:Voa,代码行数:29,代码来源:SDLWin.cpp

示例13: main

int main(int argc, const char **argv)
{
    if (argc != 4)
    {
        fprintf(stderr, "Usage: %s ServerIP Port Key\n", argv[0]);
        return 1;
    }

    auto event_loop = snet::CreateEventLoop();
    snet::TimerList timer_list;

    Server server(argv[1], atoi(argv[2]), argv[3],
                  event_loop.get(), &timer_list);

    if (!server.IsListenOk())
    {
        fprintf(stderr, "Listen address %s:%d error\n",
                SOCKS5_LISTEN_IP, SOCKS5_LISTEN_PORT);
        return 1;
    }

    snet::TimerDriver timer_driver(timer_list);
    event_loop->AddLoopHandler(&timer_driver);
    event_loop->Loop();

    return 0;
}
开发者ID:airtrack,项目名称:snet,代码行数:27,代码来源:Client.cpp

示例14: while

int CApp::Execute() {
    if(Init() == false) {
        std::cout << "Init unsuccesed\n";
        return -1;
    }
    std::cout << "Init succesed\n";
    mStateManager->Change(CStateIntro::Instance(), this);
    
    while(!mDone) {
        loop_tick = 0;
        while( SDL_GetTicks() > next_game_tick && loop_tick < MAX_FRAMESKIP)
        {
            while( SDL_PollEvent(&mEvent) ) {
                Event();
            }
            Loop();
            next_game_tick += SKIP_TICKS;
            loop_tick++;
        }
        Render();
    }
    
    Cleanup();
    return 0;
}
开发者ID:roxygen,项目名称:Oxygen,代码行数:25,代码来源:CApp.cpp

示例15: main

/*** Main ***/
int main( int argc, char** argv )
{
  Init();    // Inicializo recursos

  /* Conteo del tiempo */
  struct timeval iTime = { 0, 0 };
  struct timeval fTime = { 0, 0 };
  float elapsed        = 0.0f;
  gettimeofday( &iTime, NULL );

  /* Loop Init */
  while( !g_ExitProgram )
  {
      gettimeofday( &fTime, NULL );                            // Tiempo Actual
      elapsed = ( fTime.tv_usec - iTime.tv_usec ) / 1000000.0f // Microsegundos
	        + ( fTime.tv_sec - iTime.tv_sec );             // Segundos
      iTime = fTime;                                           // Actualizo el tiempo

      Loop( elapsed );    // Mensajes y Loop(video, sonido, input, etc...)
  }
  /* Loop End */

  Free();    // Libero Recursos
  
  return 0;
}
开发者ID:paladines4653,项目名称:compugrafica,代码行数:27,代码来源:opengl.c


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