本文整理汇总了C++中Publisher::run方法的典型用法代码示例。如果您正苦于以下问题:C++ Publisher::run方法的具体用法?C++ Publisher::run怎么用?C++ Publisher::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Publisher
的用法示例。
在下文中一共展示了Publisher::run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: publisher
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
Publisher publisher (argc, argv);
publisher.run ();
}
catch (Publisher::InitError& ex)
{
std::string& msg = reinterpret_cast<std::string&>(ex);
std::cerr << "Initialization Error: "
<< msg.c_str() << std::endl;
return -1;
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (
"ERROR: Publisher caught exception");
return -1;
}
return 0;
}
示例2: while
static int
main(int argc, char* argv[])
{
Publisher generator;
bool isAuto = false;
bool isRead = false;
int opt;
while ((opt = getopt(argc, argv, "d:f:s:t:")) != -1) {
switch (opt) {
case 'd':
{
generator.dataPrefix = ndn::Name(std::string(optarg));
generator.mode = AUTO;
isAuto = true;
}
break;
case 'f':
{
isRead = true;
generator.mode = READFILE;
std::string str = std::string(optarg);
generator.insertStream.open(str.c_str());
if (!generator.insertStream.is_open()) {
std::cerr << "ERROR: cannot open " << std::string(optarg) << std::endl;
return 1;
}
}
break;
case 's':
try {
generator.duration = milliseconds(boost::lexical_cast<uint64_t>(optarg));
}
catch (const boost::bad_lexical_cast&) {
std::cerr << "-s option should be an integer" << std::endl;;
return 1;
}
break;
case 't':
try {
generator.timeInterval = milliseconds(boost::lexical_cast<uint64_t>(optarg));
}
catch (const boost::bad_lexical_cast&) {
std::cerr << "-t option should be an integer" << std::endl;;
return 1;
}
break;
default:
usage();
break;
}
}
argc -= optind;
argv += optind;
if (argc != 0)
usage();
if (isAuto && isRead)
usage();
generator.run();
return 0;
}