本文整理汇总了C++中TaskManager::get_ordered_task_behaviour方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskManager::get_ordered_task_behaviour方法的具体用法?C++ TaskManager::get_ordered_task_behaviour怎么用?C++ TaskManager::get_ordered_task_behaviour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskManager
的用法示例。
在下文中一共展示了TaskManager::get_ordered_task_behaviour方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_task_random_RT_AAT_FAI
bool test_task_random_RT_AAT_FAI(TaskManager& task_manager,
const Waypoints &waypoints,
const unsigned _num_points)
{
const Waypoint *wp;
OrderedTaskPoint *tp;
AbstractTaskFactory &fact = task_manager.get_factory();
char tmp[255];
char tskType[20];
tskType[0] = '\0';
switch (rand() %3) {
case 0:
task_manager.set_factory(TaskBehaviour::FACTORY_AAT);
strcpy(tskType,"AAT");
test_note("# creating random AAT task\n");
break;
case 1:
task_manager.set_factory(TaskBehaviour::FACTORY_RT);
strcpy(tskType,"RT");
test_note("# creating random RT task\n");
break;
case 2:
task_manager.set_factory(TaskBehaviour::FACTORY_FAI_GENERAL);
strcpy(tskType,"FAI");
test_note("# creating random FAI GENERAL\n");
break;
}
//max points includes start & finish
const unsigned num_points_total = (
max(task_manager.get_ordered_task_behaviour().min_points,
(_num_points % task_manager.get_ordered_task_behaviour().max_points) + 1));
const unsigned num_int_points = num_points_total - 2;
test_note("# adding start\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getStartTypes()[(rand() % fact.getStartTypes().size())];
tp = fact.createStart(s,*wp);
if (!fact.append(*tp,false)) {
return false;
}
delete tp;
}
for (unsigned i=0; i<num_int_points; i++) {
test_note("# adding intermediate\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getIntermediateTypes()[(rand() % fact.getIntermediateTypes().size())];
tp = fact.createIntermediate(s,*wp);
if (!fact.append(*tp,false)) {
return false;
}
delete tp;
}
}
test_note("# adding finish\n");
wp = random_waypoint(waypoints);
if (wp) {
AbstractTaskFactory::LegalPointType_t s =
fact.getFinishTypes()[(rand() % fact.getFinishTypes().size())];
tp = fact.createFinish(s,*wp);
if (!fact.append(*tp,false)) {
return false;
}
delete tp;
}
test_note("# validating task..\n");
if (!fact.validate()) {
return false;
}
if (task_manager.get_ordered_task().get_factory_type()
== TaskBehaviour::FACTORY_FAI_GENERAL)
{
test_note("# checking OZs for FAI General..\n");
if (!fact.validateFAIOZs())
return false;
}
task_manager.resume();
sprintf(tmp, "# SUCCESS CREATING %s task! task_size():%d..\n",
tskType,
task_manager.task_size());
test_note(tmp);
return true;
}