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


C++ ITask类代码示例

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


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

示例1: display

//Called to update the display.
//You should call glutSwapBuffers after all of your rendering to display what you rendered.
//If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function.
void display()
{
    if (cullFlag)
    {
        glEnable(GL_CULL_FACE);
    }
    else
    {
        glDisable(GL_CULL_FACE);
    }

    if (lineModeFlag)
    {
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    }
    else
    {
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    }

    ITask* currentTask = tasks[currentTaskNumber];
    if (currentTask != NULL)
    {
        currentTask->Draw();
    }

    // bind 1-3
    glutSwapBuffers();
}
开发者ID:merxbj,项目名称:src,代码行数:32,代码来源:AssignmentOneMain.cpp

示例2: init

//Called after the window and OpenGL are initialized. Called exactly once, before the main loop.
void init()
{
    tasks.push_back(new TaskOne());
    tasks.push_back(new TaskTwo());
    tasks.push_back(new TaskThree());
    tasks.push_back(new TaskFour());
    tasks.push_back(new BonusTask());

    // initialize all our new tasks
    for (TaskVector::iterator it = tasks.begin(); it != tasks.end(); it++)
    {
        ITask* task = (*it);
        task->InitializeProgram();
        task->Initialize();
    }

    currentTaskNumber = 0;
    ITask* currentTask = tasks[currentTaskNumber];
    if (currentTask != NULL)
    {
        currentTask->InitializeProgram();
    }

    glCullFace(GL_BACK);  // only back faces will be culled, if enabled
    glClearColor(0.3f, 0.3f, 0.3f, 1.0f); // color for cleaning the screen
}
开发者ID:merxbj,项目名称:src,代码行数:27,代码来源:AssignmentOneMain.cpp

示例3: sprintf

//---------------------------------------------------------------------------
int TTaskScheduler::AddNewScheduledTask(wstring taskName){

    /////////////////////////////////////////////////////////////////
    // Call ITaskScheduler::NewWorkItem to create new task.
    /////////////////////////////////////////////////////////////////
    ITask *pITask;



    HRESULT hr = pITS->NewWorkItem(taskName.data(),           // Name of task
                         CLSID_CTask,            // Class identifier
                         IID_ITask,              // Interface identifier
                         (IUnknown**)&pITask); // Address of task interface



    if (FAILED(hr)){
        sprintf(lastError, "Failed calling NewWorkItem, error = 0x%x\n",hr);
        return 0;
    }


    Save(pITask);

    pITask->Release();
    return 1;

    
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:30,代码来源:TTaskScheduler.cpp

示例4: qsrand

bool LocalXmlBackend::start()
{
  qsrand( QDateTime::currentDateTime().toMSecsSinceEpoch() );
  QList<OpenTodoList::IAccount*> accounts = m_database->getAccounts(
        OpenTodoList::IDatabase::QueryAny, 1 );
  if ( accounts.isEmpty() ) {
    m_account = m_database->createAccount();
    m_account->setUuid( QUuid::createUuid() );
  } else {
    m_account = accounts.first();
  }
  m_account->setName( tr( "Local Todo Lists" ) );
  m_database->insertAccount( m_account );

  QStringList todoLists = locateTodoLists();
  for ( const QString &todoListFile : todoLists ) {
    fixTodoList( todoListFile );
    ITodoList *todoList = m_database->createTodoList();
    QDomDocument doc = documentForFile( todoListFile );
    QByteArray todoListHash;
    if ( domToTodoList( doc, todoList ) && todoListNeedsUpdate( todoList, todoListFile, todoListHash ) ) {
      todoList->insertMetaAttribute( TodoListMetaFileName, todoListFile );
      todoList->insertMetaAttribute( TodoListMetaHash, todoListHash );
      todoList->setAccount( m_account->uuid() );
      m_database->insertTodoList( todoList );
    }

    QStringList todos = locateTodos( todoListFile );
    for ( const QString &todoFile : todos ) {
      fixTodo( todoFile );
      ITodo *todo = m_database->createTodo();
      doc = documentForFile( todoFile );
      QByteArray todoHash;
      if ( domToTodo( doc, todo ) && todoNeedsUpdate( todo, todoFile, todoHash )) {
        todo->insertMetaAttribute( TodoMetaFileName, todoFile );
        todo->insertMetaAttribute( TodoMetaHash, todoHash );
        todo->setTodoList( todoList->uuid() );
        m_database->insertTodo( todo );
      }

      QStringList tasks = locateTasks( todoFile );
      for ( const QString &taskFile : tasks ) {
        ITask *task = m_database->createTask();
        doc = documentForFile( taskFile );
        QByteArray taskHash;
        if ( domToTask( doc, task ) && taskNeedsUpdate( task, taskFile, taskHash ) ) {
          task->insertMetaAttribute( TaskMetaFileName, taskFile );
          task->insertMetaAttribute( TaskMetaHash, taskHash );
          task->setTodo( todo->uuid() );
          m_database->insertTask( task );
        }
        delete task;
      }
      delete todo;
    }
    delete todoList;
  }
  return true;
}
开发者ID:uglide,项目名称:opentodolist,代码行数:59,代码来源:localxmlbackend.cpp

示例5: removeResult

void TaskQueue::onTick()
{
	ITask* task = removeResult();
	if (task != nullptr)
	{
		task->exeResult();
		SAFE_DELETE(task);
	}
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:9,代码来源:TaskQueue.cpp

示例6: while

	void Worker::Run() {
		while (!_Shutdown) {
			ITask* currentJob = _Q->FetchTask();
			if (currentJob != NULL) {
				currentJob->Run();
				if (currentJob->ToBeDisposedByWorker()) {
					delete currentJob;
				}
			}
		}
	}
开发者ID:RGafiyatullin,项目名称:kyte,代码行数:11,代码来源:Worker.cpp

示例7: hashForFile

bool LocalXmlBackend::taskNeedsUpdate(ITask *task, const QString &fileName, QByteArray &hash) const
{
  bool result = true;
  hash = hashForFile( fileName );
  ITask *existingTask = m_database->getTask( task->uuid() );
  if ( existingTask ) {
    result = existingTask->metaAttributes().value( TaskMetaHash ).toByteArray() != hash;
    delete existingTask;
  }
  return result;
}
开发者ID:uglide,项目名称:opentodolist,代码行数:11,代码来源:localxmlbackend.cpp

示例8:

//---------------------------------------------------------------------------
//	@function:
//		IMemoryPool::FSimulateAllocFailure
//
//	@doc:
//		Check whether to simulate an OOM
//
//---------------------------------------------------------------------------
BOOL
CMemoryPoolInjectFault::SimulateAllocFailure()
{
	ITask *task = ITask::Self();
	if (NULL != task)
	{
		return
			task->IsTraceSet(EtraceSimulateOOM) &&
			CFSimulator::FSim()->NewStack(CException::ExmaSystem, CException::ExmiOOM);
	}

	return false;
}
开发者ID:b-xiang,项目名称:gporca,代码行数:21,代码来源:CMemoryPoolInjectFault.cpp

示例9: run

 virtual void run()
 {
     while(true)
     {
         ITask * task = ptThreadPool_->queue_.pop();
         if(task == NULL) 
         {
             break;
         }
         task->run();
         delete task;
     }
 }
开发者ID:ChinaLongGanHu,项目名称:cppjieba,代码行数:13,代码来源:ThreadPool.hpp

示例10: GetTaskDetails2

void GetTaskDetails2(wchar_t* buf, int bufSize, ITaskScheduler *pITS, LPCWSTR lpcwszTaskName)
{
  
  HRESULT hr = S_OK;
  ITask *pITask = 0;
  wchar_t tmp[500];

  hr = pITS->Activate(lpcwszTaskName, IID_ITask, (IUnknown**) &pITask);
  
  if (FAILED(hr))
  {
     _snwprintf(tmp, sizeof(tmp), L"Failed calling ITaskScheduler::Activate; error = 0x%x\n",hr);
	 wcsncat(buf, tmp, bufSize);
     return;
  }

  LPWSTR lpwszApplicationName;
  hr = pITask->GetApplicationName(&lpwszApplicationName);

  if (FAILED(hr))
  {
     _snwprintf(tmp, sizeof(tmp), L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
	 wcsncat(buf, tmp, bufSize);
     lpwszApplicationName = 0;
  }

  LPWSTR lpwszParameters;
  hr = pITask->GetParameters(&lpwszParameters);

  if (FAILED(hr))
  {
     _snwprintf(tmp, sizeof(tmp),  L"Failed calling ITask::GetApplicationName error = 0x%x\n", hr);
	 wcsncat(buf, tmp, bufSize);
	 lpwszParameters = 0;
  }

  pITask->Release();

  if(lpwszApplicationName){
	  _snwprintf(tmp, sizeof(tmp),  L"\t-Exe: %s\n", lpwszApplicationName);
	  wcsncat(buf, tmp, bufSize);
	  CoTaskMemFree(lpwszApplicationName);
  }

  if(lpwszParameters){
	  _snwprintf(tmp, sizeof(tmp),  L"\t-Params: %s\n", lpwszParameters);
	  wcsncat(buf, tmp, bufSize);
	  CoTaskMemFree(lpwszParameters);
  }

}
开发者ID:dzzie,项目名称:SysAnalyzer,代码行数:51,代码来源:enumMutex.cpp

示例11: DoTasks

	void DoTasks()
	{
		ITask* task ;
		do
		{
			{
				CriticalSectionHelper c;
				task = Tasks.Dequeue();
			}
			if(task!=NULL)
				task->DoTask();
		}
		while(task!=NULL);
	}
开发者ID:supox,项目名称:sprinkler_arm,代码行数:14,代码来源:Scheduler.cpp

示例12: FuncTimerCallback

void FuncTimerCallback(int value)
{
    if (spinFlag)
    {
        glutTimerFunc(TIMER_STEP, FuncTimerCallback, 0);  //333 (1%) -> 3 -> (14%)

        ITask* currentTask = tasks[currentTaskNumber];
        if (currentTask != NULL)
        {
            currentTask->Update();
        }
    }
    glutPostRedisplay();
}
开发者ID:merxbj,项目名称:src,代码行数:14,代码来源:AssignmentOneMain.cpp

示例13:

//---------------------------------------------------------------------------
//	@function:
//		CAutoMemoryPool::~CAutoMemoryPool
//
//	@doc:
//		Release the pool back to the manager and perform leak checks if
//		(1) strict leak checking indicated, or
//		(2) no checking while pending exception indicated and no pending exception
//
//---------------------------------------------------------------------------
CAutoMemoryPool::~CAutoMemoryPool()
{
	if (NULL == m_mp)
	{
		return;
	}
	
	// suspend cancellation
	CAutoSuspendAbort asa;

#ifdef GPOS_DEBUG

	ITask *task = ITask::Self();
	
	// ElcExc must be used inside tasks only
	GPOS_ASSERT_IMP(ElcExc == m_leak_check_type, NULL != task);
	
	GPOS_TRY
	{
		if (ElcStrict == m_leak_check_type || (ElcExc == m_leak_check_type && !task->GetErrCtxt()->IsPending()))
		{
			gpos::IOstream &os = gpos::oswcerr;

			// check for leaks, use this to trigger standard Assert handling
			m_mp->AssertEmpty(os);
		}

		// release pool
		CMemoryPoolManager::GetMemoryPoolMgr()->Destroy(m_mp);
	}
	GPOS_CATCH_EX(ex)
	{
		GPOS_ASSERT(GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiAssert));

		// release pool
		CMemoryPoolManager::GetMemoryPoolMgr()->Destroy(m_mp);	
		
		GPOS_RETHROW(ex);
	}
	GPOS_CATCH_END;

#else // GPOS_DEBUG
	
	// hand in pool and return
	CMemoryPoolManager::GetMemoryPoolMgr()->Destroy(m_mp);

#endif // GPOS_DEBUG
}
开发者ID:b-xiang,项目名称:gporca,代码行数:58,代码来源:CAutoMemoryPool.cpp

示例14: lock

gep::Result gep::TaskWorker::runSingleTask()
{
    ITask* pTaskToExecute = nullptr;
    {
        // try to get a task from our internal task list
        ScopedLock<Mutex> lock(m_tasksMutex);
        if(m_tasks.length() == 0)
            return FAILURE;
        pTaskToExecute = m_tasks.lastElement();
        m_tasks.resize(m_tasks.length() - 1);
    }

    pTaskToExecute->execute();
    m_pActiveGroup->taskFinished();
    return SUCCESS;
}
开发者ID:Manuzor,项目名称:risky-epsilon,代码行数:16,代码来源:taskqueue.cpp

示例15: remove

void CTaskManager::remove(ITask &task)
{
	//nlinfo("Removing task %s", task.name().c_str());
	// release and remove task from Task
	for(std::list<ITask*>::iterator it = Tasks.begin(); it != Tasks.end();)
	{
		if(&task == (*it))
		{
			Tasks.erase(it);
			break;
		}
		else
		{
			it++;
		}
	}
	// remove task from OrderSortedTasks
	for(std::list<ITask*>::iterator it = OrderSortedTasks.begin(); it != OrderSortedTasks.end();)
	{
		if(&task == (*it))
		{
			OrderSortedTasks.erase(it);
			break;
		}
		else
		{
			it++;
		}
	}
	//nlinfo("Removed task %s from list", task.name().c_str());
	task.release();
	//nlinfo("Removed task %s and release called", task.name().c_str());
}
开发者ID:StraToN,项目名称:tux-target,代码行数:33,代码来源:task_manager.cpp


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