本文整理汇总了C++中TaskPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TaskPtr::getName方法的具体用法?C++ TaskPtr::getName怎么用?C++ TaskPtr::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TaskPtr
的用法示例。
在下文中一共展示了TaskPtr::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeTask
void ThreadGroup::executeTask(const TaskPtr& task)
{
try {
std::unique_lock<std::recursive_mutex> state_lock(execution_mtx_);
ProfilerPtr profiler = getProfiler();
Trace::Ptr interlude;
if (profiler && profiler->isEnabled()) {
TimerPtr timer = profiler->getTimer(getName());
interlude.reset(new Trace(timer, task->getName()));
}
task->execute();
} catch (const std::exception& e) {
TaskGenerator* gen = task->getParent();
if (gen) {
gen->setError(e.what());
}
} catch (const std::string& s) {
std::cerr << "Uncaught exception (string) exception: " << s << std::endl;
} catch (const csapex::Failure& assertion) {
handler_.handleAssertionFailure(assertion);
} catch (...) {
std::cerr << "Uncaught exception of unknown type and origin in execution of task " << task->getName() << "!" << std::endl;
throw;
}
}
示例2: addTask
void TaskManager::addTask(TaskPtr task)
{
std::list<TaskPtr>::iterator it = tasks_.begin();
// attempt to find task
std::list<TaskPtr>::iterator found = std::find_if(tasks_.begin(),
tasks_.end(),
std::bind2nd(TaskNameEq(), task->getName()) );
// if found task (meaning task w/ same name exists) throw exception
if(found != tasks_.end())
{
throw PreconditionException("Attempted to add duplicate task \"" +
task->getName() + "\".");
}
task->onStart(); // called whenever a task is being started
// find the first task in the list with a lower priority
while(it != tasks_.end() && (*it)->getPriority() <= task->getPriority())
{
++it;
}
tasks_.insert(it, task); // insert task after iterator
}
示例3:
bool TaskManager::TaskNameEq::operator()(const TaskPtr& lhs,
const std::string& rhs) const
{
return lhs->getName() == rhs;
}