本文整理汇总了C++中Configurator::setConnectionManager方法的典型用法代码示例。如果您正苦于以下问题:C++ Configurator::setConnectionManager方法的具体用法?C++ Configurator::setConnectionManager怎么用?C++ Configurator::setConnectionManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configurator
的用法示例。
在下文中一共展示了Configurator::setConnectionManager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
LOG(LNOTICE) << " run DisCODe in interactive mode (-I)";
exit(EXIT_FAILURE);
} else {
task_name = conf.get<std::string>("DisCODe.task");
LOG(LINFO) << "Task: " << task_name << " from configuration file\n";
}
} else {
LOG(LINFO) << "Task: " << task_name << " from command line\n";
}
std::vector<std::pair<std::string, std::string> > overrides;
for (size_t i = 0; i < task_overrides.size(); ++i) {
std::vector<std::string> strs;
boost::split(strs, task_overrides[i], boost::is_any_of("="));
if (strs.size() == 1) {
LOG(LWARNING) << strs[0] << "have no assigned value";
} else {
overrides.push_back(std::make_pair(strs[0], strs[1]));
}
}
// =========================================================================
// === Main program part
// =========================================================================
Configurator configurator;
ComponentManager km;
ExecutorManager em;
ConnectionManager cm;
Task task;
configurator.setExecutorManager(&em);
configurator.setComponentManager(&km);
configurator.setConnectionManager(&cm);
TaskInformer task_informer(task);
ComponentInformer component_informer(km);
SystemInformer system_informer(running);
ExecutorInformer executor_informer(em);
try {
CommandServer server;
server.addInformer(&task_informer);
server.addInformer(&component_informer);
server.addInformer(&system_informer);
server.addInformer(&executor_informer);
server.printCommands();
server.start();
km.initializeComponentsList();
task = configurator.loadConfiguration(task_name, overrides);
if (!task.start()) {
LOG(LFATAL) << "Task::start() returned false\n";
running = false;
}
while(running) {
Common::Thread::msleep(50);
}
Common::Thread::msleep(500);
task.finish();
km.release();
cm.release();
em.release();
km.deactivateComponentList();
server.stop();
}//: try
// =========================================================================
// === Exception handling
// =========================================================================
catch (Common::DisCODeException& ex) {
LOG(LFATAL) << ex.what() << "\n";
ex.printStackTrace();
exit(EXIT_FAILURE);
}
catch (exception& ex) {
LOG(LFATAL) << ex.what() << "\n";
exit(EXIT_FAILURE);
}
catch (const char * ex) {
LOG(LFATAL) << ex << "\n";
exit(EXIT_FAILURE);
}
catch (...) {
LOG(LFATAL) << "Unknown exception.\n";
exit(EXIT_FAILURE);
}//: catch
}