本文整理汇总了C++中Monitor::isRunning方法的典型用法代码示例。如果您正苦于以下问题:C++ Monitor::isRunning方法的具体用法?C++ Monitor::isRunning怎么用?C++ Monitor::isRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::isRunning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
int prosilicaComp::run(int argc, char* argv[])
{
#ifdef USE_QTGUI
QApplication a(argc, argv); // GUI application
#else
QCoreApplication a(argc, argv); // NON-GUI application
#endif
int status=EXIT_SUCCESS;
// Remote server proxy access example
// RemoteComponentPrx remotecomponent_proxy;
DifferentialRobotPrx differentialrobot_proxy;
JointMotorPrx jointmotor_proxy;
string proxy;
// User variables
initialize();
// Remote server proxy creation example
// try
// {
// // Load the remote server proxy
// proxy = getProxyString("RemoteProxy");
// remotecomponent_proxy = RemotePrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
// if( !remotecomponent_proxy )
// {
// rInfo(QString("Error loading proxy!"));
// return EXIT_FAILURE;
// }
//catch(const Ice::Exception& ex)
//{
// cout << "[" << PROGRAM_NAME << "]: Exception: " << ex << endl;
// return EXIT_FAILURE;
//}
//rInfo("RemoteProxy initialized Ok!");
// // Now you can use remote server proxy (remotecomponent_proxy) as local object
try
{
// Load the remote server proxy
proxy = getProxyString("DifferentialRobotProxy");
differentialrobot_proxy = DifferentialRobotPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
if( !differentialrobot_proxy )
{
rInfo(QString("Error loading proxy!"));
return EXIT_FAILURE;
}
}
catch(const Ice::Exception& ex)
{
cout << "[" << PROGRAM_NAME << "]: Exception: " << ex << endl;
return EXIT_FAILURE;
}
rInfo("DifferentialRobotProxy initialized Ok!");
try
{
// Load the remote server proxy
proxy = getProxyString("JointMotorProxy");
jointmotor_proxy = JointMotorPrx::uncheckedCast( communicator()->stringToProxy( proxy ) );
if( !jointmotor_proxy )
{
rInfo(QString("Error loading proxy!"));
return EXIT_FAILURE;
}
}
catch(const Ice::Exception& ex)
{
cout << "[" << PROGRAM_NAME << "]: Exception: " << ex << endl;
return EXIT_FAILURE;
}
rInfo("JointMotorProxy initialized Ok!");
Worker *worker = new Worker(differentialrobot_proxy, jointmotor_proxy);
//Monitor thread
Monitor *monitor = new Monitor(worker,communicator());
QObject::connect(monitor,SIGNAL(kill()),&a,SLOT(quit()));
QObject::connect(worker,SIGNAL(kill()),&a,SLOT(quit()));
monitor->start();
if ( !monitor->isRunning() )
return status;
try
{
// Server adapter creation and publication
Ice::ObjectAdapterPtr adapterCommonBehavior = communicator()->createObjectAdapter("CommonBehavior");
CommonBehaviorI *commonbehaviorI = new CommonBehaviorI(monitor );
adapterCommonBehavior->add(commonbehaviorI, communicator()->stringToIdentity("commonbehavior"));
adapterCommonBehavior->activate();
// Server adapter creation and publication
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("prosilicaComp");
//.........这里部分代码省略.........
示例2: run
int dunkermotorenComp::run(int argc, char* argv[])
{
#ifdef USE_QTGUI
QApplication a(argc, argv); // GUI application
#else
QCoreApplication a(argc, argv); // NON-GUI application
#endif
int status=EXIT_SUCCESS;
// Remote server proxy access example
// RemoteComponentPrx remotecomponent_proxy;
string proxy;
// User variables
initialize();
Worker *worker = new Worker();
//Monitor thread
Monitor *monitor = new Monitor(worker, communicator());
QObject::connect(monitor,SIGNAL(kill()),&a,SLOT(quit()));
QObject::connect(worker,SIGNAL(kill()),&a,SLOT(quit()));
monitor->start();
if (!monitor->isRunning())
{
qDebug()<<"ERROR: Couldn't start monitor and configuration";
return status;
}
try
{
// Server adapter creation and publication
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("dunkermotorenComp");
JointMotorI *jointmotorI = new JointMotorI(worker);
adapter->add(jointmotorI, communicator()->stringToIdentity("jointmotor"));
adapter->activate();
cout << SERVER_FULL_NAME " started" << endl;
// User defined QtGui elements ( main window, dialogs, etc )
#ifdef USE_QTGUI
//ignoreInterrupt(); // Uncomment if you want the component to ignore console SIGINT signal (ctrl+c).
a.setQuitOnLastWindowClosed( true );
#endif
// Run QT Application Event Loop
a.exec();
status = EXIT_SUCCESS;
}
catch(const Ice::Exception& ex)
{
status = EXIT_FAILURE;
cout << "[" << PROGRAM_NAME << "]: Exception raised on main thread: " << endl;
cout << ex;
#ifdef USE_QTGUI
a.quit();
#endif
}
return status;
}