• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TaskManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TaskManager

void TestTaskManager::fail_registerMachine_command_not_found()
{
    TaskManager *manager = new TaskManager();
    QSignalSpy   sig_reg(manager,
                       SIGNAL(registerMachineStatus(TaskStatus, QString)));
    QVariantList response;
    TaskStatus   status;
    QString      reason;

    // Fail to register with a non-existent tarsnap dir.
    manager->registerMachine("fake-user", "fake-password", "fake-machine",
                             "fake.key", "/fake/dir",
                             "/tmp/gui-test-tarsnap-cache");
    QTest::qWait(TASK_CMDLINE_WAIT_MS);

    // Get failure message.
    QVERIFY(sig_reg.count() == 1);
    response = sig_reg.takeFirst();
    status   = response.at(0).value<TaskStatus>();
    reason   = response.at(1).toString();
    QVERIFY(status == TaskStatus::Failed);
    QVERIFY(reason == "Could not find the command-line program");

    delete manager;
}
开发者ID:Tarsnap,项目名称:tarsnap-gui,代码行数:25,代码来源:test-taskmanager.cpp


示例2: lock

void ZoneServerImplementation::printInfo() {
	lock();

	TaskManager* taskMgr = Core::getTaskManager();
	StringBuffer msg;

	if (taskMgr != NULL)
		msg << taskMgr->getInfo(false) << endl;
	//msg << "MessageQueue - size = " << processor->getMessageQueue()->size() << endl;

	float packetloss;
	if (totalSentPackets + totalSentPackets == 0)
		packetloss = 0.0f;
	else
		packetloss = (100 * totalResentPackets) / (totalResentPackets + totalSentPackets);

#ifndef WITH_STM
	msg << "sent packets = " << totalSentPackets << ", resent packets = "
		<< totalResentPackets << " [" << packetloss << "%]" << endl;
#endif

	msg << dec << currentPlayers << " users connected (" << maximumPlayers << " max, " << totalPlayers << " total, "
		 << totalDeletedPlayers << " deleted)" << endl;

#ifndef WITH_STM
	msg << ObjectManager::instance()->getInfo() << endl;

	if (playerManager != NULL)
		msg << dec << playerManager->getOnlineZoneClientMap()->getDistinctIps() << " total distinct ips connected";
#endif

	unlock();

	info(msg.toString(), true);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:35,代码来源:ZoneServerImplementation.cpp


示例3: assert

void TaskManagerTest::testError()
{
	TaskManager tm;
	TaskObserver to;
	tm.addObserver(Observer<TaskObserver, TaskStartedNotification>(to, &TaskObserver::taskStarted));
	tm.addObserver(Observer<TaskObserver, TaskCancelledNotification>(to, &TaskObserver::taskCancelled));
	tm.addObserver(Observer<TaskObserver, TaskFailedNotification>(to, &TaskObserver::taskFailed));
	tm.addObserver(Observer<TaskObserver, TaskFinishedNotification>(to, &TaskObserver::taskFinished));
	tm.addObserver(Observer<TaskObserver, TaskProgressNotification>(to, &TaskObserver::taskProgress));
	AutoPtr<TestTask> pTT = new TestTask;
	tm.start(pTT.duplicate());
	assert (pTT->progress() == 0);
	Thread::sleep(200);
	pTT->cont();
	while (pTT->progress() != 0.5) Thread::sleep(50);
	assert (to.progress() == 0.5);
	assert (to.started());
	assert (pTT->state() == Task::TASK_RUNNING);
	TaskManager::TaskList list = tm.taskList();
	assert (list.size() == 1);
	assert (tm.count() == 1);
	pTT->fail();
	pTT->cont();
	while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50);
	assert (pTT->state() == Task::TASK_FINISHED);
	assert (to.finished());
	assert (to.error() != 0);
	while (tm.count() == 1) Thread::sleep(50);
	list = tm.taskList();
	assert (list.empty());
}
开发者ID:austinsc,项目名称:Poco,代码行数:31,代码来源:TaskManagerTest.cpp


示例4: validate

void validate(const TaskManager& tasks, const ItemManager& items, std::ostream& os){
    auto taskEnd = tasks.cend();
    auto itemEnd = items.cend();
    
    const int EQUAL = 0;
    
    bool isAvailable;
    
    // enumerate all tiems
    for (auto item = items.cbegin(); item != itemEnd; ++item) {
        isAvailable = false;
        
        // enumerate all tasks, compare each task with item destination
        for (auto singleTask = tasks.cbegin(); singleTask != taskEnd; ++singleTask) {
            
            if((item->getDestination()).compare(singleTask->getName()) == EQUAL){
                isAvailable = true;
                break;
            }
        }
        if (isAvailable == false) {
            os << item->getDestination() << " is unavailable\n";
        }
    }
    
}
开发者ID:EricZhang90,项目名称:Assembly-Line-Manager,代码行数:26,代码来源:TaskManager.cpp


示例5: workerLoop

/// Worker Worker routine.
/// This is the routine every worker thread runs.
/// The worker thread continuously asks for Tasks and executes them.
///
/// Note that worker threads are NOT guarenteed to ever call Worker.exit()
/// before the program ends.
void workerLoop ( Worker * me, void* args ) {
  task_worker_args* wargs = (task_worker_args*) args;
  TaskManager* tasks = wargs->tasks;
  TaskingScheduler * sched = wargs->scheduler; 

  sched->onWorkerStart();

  StateTimer::setThreadState( StateTimer::FINDWORK );
  StateTimer::enterState_findwork();

  Task nextTask;

  while ( true ) {
    // block until receive work or termination reached
    if (!tasks->getWork(&nextTask)) break; // quitting time

    sched->num_active_tasks++;
    StateTimer::setThreadState( StateTimer::USER );
    StateTimer::enterState_user();
    {
      GRAPPA_PROFILE( exectimer, "user_execution", "", GRAPPA_USER_GROUP );
      nextTask.execute();
    }
    StateTimer::setThreadState( StateTimer::FINDWORK );
    sched->num_active_tasks--;

    sched->thread_yield( ); // yield to the scheduler
  }
}
开发者ID:kawuum,项目名称:grappa,代码行数:35,代码来源:TaskingScheduler.cpp


示例6: main

int main()
{
	CanStorage c_list;
	MoneyKeeper mk;
	ioHandler ioh;
	TaskManager tm;

	// load from file.
	ioh.loadCanStorage("canlist.txt", c_list);

	while (1)
	{
		int menu = ioh.getMenu();
		if (menu == EXIT) break; // 프로그램 종료

		switch (menu)
		{
		case COIN_DEPOSIT:
			// 동전투입
			tm.insertCoin(mk);
			break;
		case ITEM_SELECTION:
			// 상품선택
			tm.selectMenu(mk, c_list);
			break;
		case CHANGE_RETURN:
			// 잔돈반환
			tm.returnCoin(mk);
			break;
		case EXIT:
			// 프로그램 종료
			return 0;
		}
	}
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例7: test_task_fai

bool test_task_fai(TaskManager& task_manager,
                   const Waypoints &waypoints)
{
  task_manager.set_factory(TaskBehaviour::FACTORY_FAI_GENERAL);
  AbstractTaskFactory &fact = task_manager.get_factory();
  const Waypoint *wp;

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    OrderedTaskPoint *tp = fact.createStart(*wp);
    if (!fact.append(*tp)) {
      return false;
    }
    delete tp;
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    OrderedTaskPoint *tp = fact.createIntermediate(*wp);
    if (!fact.append(*tp, false)) {
      return false;
    }
    delete tp;
  }

  task_report(task_manager, "# adding intermdiate\n");
  wp = waypoints.lookup_id(3);
  if (wp) {
    OrderedTaskPoint *tp = fact.createIntermediate(*wp);
    if (!fact.append(*tp,false)) {
      return false;
    }
    delete tp;
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    OrderedTaskPoint *tp = fact.createFinish(*wp);
    if (!fact.append(*tp,false)) {
      return false;
    }
    delete tp;
  }

  task_report(task_manager, "# checking task\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:60,代码来源:harness_task.cpp


示例8: max

void
ChartProjection::Set(const PixelRect &rc, const TaskManager &task,
                     const GeoPoint &fallback_loc)
{
  const GeoPoint center = task.GetTaskCenter(fallback_loc);
  const fixed radius = max(fixed(10000), task.GetTaskRadius(fallback_loc));
  set_projection(rc, center, radius);
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:8,代码来源:ChartProjection.cpp


示例9: test_task_or

bool test_task_or(TaskManager& task_manager,
                  const Waypoints &waypoints)
{
    const Waypoint *wp;

    task_manager.SetFactory(TaskFactoryType::FAI_OR);
    AbstractTaskFactory &fact = task_manager.GetFactory();

    task_report(task_manager, "# adding start\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateStart(*wp);
        if (!fact.Append(*tp)) {
            return false;
        }
        delete tp;
    }

    task_manager.SetActiveTaskPoint(0);
    task_manager.Resume();

    task_report(task_manager, "# adding intermediate\n");
    wp = waypoints.LookupId(2);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateIntermediate(*wp);
        if (!fact.Append(*tp)) {
            return false;
        }
        delete tp;
    }

    task_report(task_manager, "# adding finish\n");
    wp = waypoints.LookupId(1);
    if (wp) {
        OrderedTaskPoint *tp = fact.CreateFinish(*wp);
        if (!fact.Append(*tp)) {
            return false;
        }
        delete tp;
    }

    fact.UpdateStatsGeometry();

    task_report(task_manager, "# checking task..\n");
    if (!fact.Validate()) {
        return false;
    }

    if (!task_manager.CheckOrderedTask()) {
        return false;
    }
    return true;

}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:54,代码来源:harness_task.cpp


示例10: main

	int main(const ArgVec& args)
	{
		if (!_helpRequested)
		{
			TaskManager tm;
			tm.start(new SampleTask);
			waitForTerminationRequest();
			tm.cancelAll();
			tm.joinAll();
		}
		return Application::EXIT_OK;
	}
开发者ID:12307,项目名称:poco,代码行数:12,代码来源:SampleServer.cpp


示例11: CreateDefaultTask

static void
CreateDefaultTask(TaskManager &task_manager, const Waypoints &way_points)
{
  const TCHAR start_name[] = _T("Bergneustadt");

  task_manager.set_factory(OrderedTask::FACTORY_MIXED);
  AbstractTaskFactory &factory = task_manager.get_factory();

  const Waypoint *wp;
  OrderedTaskPoint *tp;

  wp = way_points.lookup_name(start_name);
  if (wp != NULL) {
    tp = factory.createStart(AbstractTaskFactory::START_LINE, *wp);
    if (!factory.append(tp, false)) {
      fprintf(stderr, "Failed to create start point\n");
    }
  } else {
    fprintf(stderr, "No start waypoint\n");
  }

  wp = way_points.lookup_name(_T("Uslar"));
  if (wp != NULL) {
    tp = factory.createIntermediate(AbstractTaskFactory::AST_CYLINDER, *wp);
    if (!factory.append(tp, false)) {
      fprintf(stderr, "Failed to create turn point\n");
    }
  } else {
    fprintf(stderr, "No turn point\n");
  }

  wp = way_points.lookup_name(_T("Suhl Goldlaut"));
  if (wp != NULL) {
    tp = factory.createIntermediate(AbstractTaskFactory::AST_CYLINDER, *wp);
    if (!factory.append(tp, false)) {
      fprintf(stderr, "Failed to create turn point\n");
    }
  } else {
    fprintf(stderr, "No turn point\n");
  }

  wp = way_points.lookup_name(start_name);
  if (wp != NULL) {
    tp = factory.createFinish(AbstractTaskFactory::FINISH_LINE, *wp);
    if (!factory.append(tp, false)) {
      fprintf(stderr, "Failed to create finish point\n");
    }
  } else {
    fprintf(stderr, "No finish waypoint\n");
  }
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:51,代码来源:RunTaskEditorDialog.cpp


示例12:

AirspaceWarningManager::AirspaceWarningManager(const Airspaces& airspaces,
                                               const AIRCRAFT_STATE &state,
                                               const TaskManager &task_manager,
                                               const fixed& prediction_time_glide,
                                               const fixed& prediction_time_filter):
  m_airspaces(airspaces),
  m_prediction_time_glide(prediction_time_glide),
  m_prediction_time_filter(prediction_time_filter),
  m_perf_glide(task_manager.get_glide_polar()),
  m_state_filter(state, prediction_time_filter),
  m_perf_filter(m_state_filter),
  m_task(task_manager),
  m_glide_polar(task_manager.get_glide_polar())
{
}
开发者ID:galippi,项目名称:xcsoar,代码行数:15,代码来源:AirspaceWarningManager.cpp


示例13: new

// _RequestThread
int32
AuthenticationServer::_RequestThread()
{
	TaskManager taskManager;
	while (!fTerminating) {
		taskManager.RemoveDoneTasks();
		// read the request
		KMessage request;
		status_t error = request.ReceiveFrom(fRequestPort);
		if (error != B_OK)
			continue;
		// get the parameters
		const char* context = NULL;
		const char* server = NULL;
		const char* share = NULL;
		bool badPassword = true;
		request.FindString("context", &context);
		request.FindString("server", &server);
		request.FindString("share", &share);
		request.FindBool("badPassword", &badPassword);
		if (!context || !server || !share)
			continue;
		String foundUser;
		String foundPassword;
		if (!badPassword && _GetAuthentication(context, server, share,
			&foundUser, &foundPassword)) {
			_SendRequestReply(request.ReplyPort(), request.ReplyToken(),
				error, false, foundUser.GetString(), foundPassword.GetString());
		} else {
			// we need to ask the user: create a task that does it
			UserDialogTask* task = new(nothrow) UserDialogTask(this, context,
				server, share, badPassword, request.ReplyPort(),
				request.ReplyToken());
			if (!task) {
				ERROR(("AuthenticationServer::_RequestThread(): ERROR: "
					"failed to allocate "));
				continue;
			}
			status_t error = taskManager.RunTask(task);
			if (error != B_OK) {
				ERROR(("AuthenticationServer::_RequestThread(): Failed to "
					"start server info task: %s\n", strerror(error)));
				continue;
			}
		}
	}
	return 0;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:49,代码来源:AuthenticationServer.cpp


示例14: TaskManager

TaskManager& TaskManager::instance()
{
  Kernel::Singleton* s = Kernel::Framework::instance().getSingleton("TaskManager");
  if (s == nullptr)
  {
    TaskManager *f = new TaskManager("TaskManager");
    Kernel::Framework::instance().registerSingleton("TaskManager",f);
    return *f;
  }
  else
  {
    TaskManager *f = static_cast<TaskManager*>(s);
    f->registerDelayed();
    return *f;
  }
}
开发者ID:rrnntt,项目名称:SmallProject,代码行数:16,代码来源:TaskManager.cpp


示例15: RenderSpeed

void
RenderSpeed(Canvas &canvas, const PixelRect rc,
            const ChartLook &chart_look,
            const FlightStatistics &fs,
            const NMEAInfo &nmea_info,
            const DerivedInfo &derived_info,
            const TaskManager &task)
{
  ChartRenderer chart(chart_look, canvas, rc);

  if (!fs.task_speed.HasResult() || !task.CheckOrderedTask()) {
    chart.DrawNoData();
    return;
  }

  chart.ScaleXFromData(fs.task_speed);
  chart.ScaleYFromData(fs.task_speed);
  chart.ScaleYFromValue(0);
  chart.ScaleXFromValue(fs.task_speed.GetMinX());

  DrawLegs(chart, task, nmea_info, derived_info, true);

  chart.DrawXGrid(0.5,
                  ChartLook::STYLE_THINDASHPAPER, 0.5, true);
  chart.DrawYGrid(Units::ToSysTaskSpeed(10),
                  ChartLook::STYLE_THINDASHPAPER, 10, true);
  chart.DrawLineGraph(fs.task_speed, ChartLook::STYLE_MEDIUMBLACK);
  chart.DrawTrend(fs.task_speed, ChartLook::STYLE_BLUETHIN);

  chart.DrawXLabel(_T("t"), _T("hr"));
  chart.DrawYLabel(_T("h"), Units::GetTaskSpeedName());
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:32,代码来源:BarographRenderer.cpp


示例16: ProtectedTaskManager

 ProtectedTaskManager(TaskManager &_task_manager, const TaskBehaviour& tb,
                      TaskEvents& te,
                      Airspaces &airspaces)
   :Guard<TaskManager>(_task_manager),
    task_behaviour(tb), task_events(te), m_airspaces(airspaces),
    m_route(_task_manager.get_glide_polar(), m_airspaces)
   {}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:7,代码来源:ProtectedTaskManager.hpp


示例17: DrawLegs

static void
DrawLegs(ChartRenderer &chart,
         const TaskManager &task_manager,
         const NMEAInfo& basic,
         const DerivedInfo& calculated,
         const bool task_relative)
{
  const TaskStats &task_stats = calculated.ordered_task_stats;

  if (!task_stats.start.task_started)
    return;

  const auto start_time = task_relative
    ? basic.time - task_stats.total.time_elapsed
    : calculated.flight.takeoff_time;

  const OrderedTask &task = task_manager.GetOrderedTask();
  for (unsigned i = 0, n = task.TaskSize(); i < n; ++i) {
    const OrderedTaskPoint &tp = task.GetTaskPoint(i);
    if (!IsTaskLegVisible(tp))
      continue;

    auto x = tp.GetEnteredState().time - start_time;
    if (x >= 0) {
      x /= 3600;
      chart.DrawLine(x, chart.GetYMin(), x, chart.GetYMax(),
                     ChartLook::STYLE_REDTHICK);
    }
  }
}
开发者ID:kwtskran,项目名称:XCSoar,代码行数:30,代码来源:BarographRenderer.cpp


示例18: test_task_or

bool test_task_or(TaskManager& task_manager,
                     const Waypoints &waypoints)
{
  const Waypoint *wp;

  task_manager.set_factory(OrderedTask::FACTORY_TOURING);
  AbstractTaskFactory &fact = task_manager.get_factory();

  task_report(task_manager, "# adding start\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createStart(*wp))) {
      return false;
    }
  }

  task_manager.setActiveTaskPoint(0);
  task_manager.resume();

  task_report(task_manager, "# adding intermediate\n");
  wp = waypoints.lookup_id(2);
  if (wp) {
    if (!fact.append(fact.createIntermediate(*wp))) {
      return false;
    }
  }

  task_report(task_manager, "# adding finish\n");
  wp = waypoints.lookup_id(1);
  if (wp) {
    if (!fact.append(fact.createFinish(*wp))) {
      return false;
    }
  }

  task_report(task_manager, "# checking task..\n");
  if (!fact.validate()) {
    return false;
  }

  if (!task_manager.check_ordered_task()) {
    return false;
  }
  return true;

}
开发者ID:galippi,项目名称:xcsoar,代码行数:46,代码来源:harness_task.cpp


示例19: task_report

void
task_report(const TaskManager &task_manager, const char *text)
{
    AircraftState ac;
    if (verbose) {
        printf("%s",text);

        const AbstractTask *task = task_manager.GetActiveTask();
        if (task != NULL) {
            switch (task->GetType()) {
            case TaskType::NONE:
                printf("# task is none\n");
                break;

            case TaskType::ORDERED:
                printf("# task is ordered\n");
                task_manager.GetFactory().UpdateGeometry();
                break;

            case TaskType::ABORT:
                printf("# task is abort\n");
                break;

            case TaskType::GOTO:
                printf("# task is goto\n");
                break;
            }

            TaskPointVisitorPrint tpv;
            task->AcceptTaskPointVisitor(tpv);
            printf("# - dist nominal %g\n",
                   (double)task->GetStats().distance_nominal);

            if (task->GetType() == TaskType::ORDERED &&
                    task->GetStats().distance_max > task->GetStats().distance_min) {
                printf("# - dist max %g\n", (double)task->GetStats().distance_max);
                printf("# - dist min %g\n", (double)task->GetStats().distance_min);
            }
        }

        PrintHelper::taskmanager_print(task_manager, ac);
    }
    if (interactive>1) {
        WaitPrompt();
    }
}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:46,代码来源:harness_task.cpp


示例20: GetBestAlternateID

static unsigned
GetBestAlternateID(const TaskManager &tm)
{
  const auto &alternates = tm.GetAlternates();
  return alternates.empty()
    ? unsigned(-1)
    : alternates.front().waypoint.id;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,代码来源:TaskEventObserver.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TaskPoint类代码示例发布时间:2022-05-31
下一篇:
C++ TaskItem类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap