本文整理汇总了C++中SimpleClient::manager方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleClient::manager方法的具体用法?C++ SimpleClient::manager怎么用?C++ SimpleClient::manager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleClient
的用法示例。
在下文中一共展示了SimpleClient::manager方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
if (argc < 2)
return -1;
SimpleClient client;
if (client.init(argc,argv) == 0)
{
ACE_DEBUG((LM_DEBUG,"Cannot init client"));
return -1;
}
client.login();
try
{
ACS_SHORT_LOG((LM_INFO, "Getting COB: %s", argv[1]));
acsexmplBuilding::Building_var tower = client.get_object<acsexmplBuilding::Building>(argv[1], 0, true);
if (!CORBA::is_nil(tower.in()))
{
ACS_SHORT_LOG((LM_INFO, "Got COB: %s", argv[1]));
}
else
{
ACS_SHORT_LOG((LM_INFO, "Unable to access COB: %s", argv[1]));
}
}
catch( CORBA::Exception &ex )
{
ACE_PRINT_EXCEPTION (ex, "main");
}
try
{
ACS_SHORT_LOG((LM_INFO,"Releasing..."));
client.manager()->release_component(client.handle(), argv[1]);
client.logout();
}
catch( CORBA::Exception &_ex )
{
ACE_PRINT_EXCEPTION (_ex, "main");
}
ACE_OS::sleep(3);
return 0;
}
示例2: main
//.........这里部分代码省略.........
distributer->multiDisconnect(receiver.in());
notifCb->_remove_ref();
// Receiver 1 connected directly to the Sender
sender->connect(receiver1.in());
// instantiate and activate user callbacks for the notification
BulkDataTestNotificationCb *notifCb1 = new BulkDataTestNotificationCb();
ACS::CBvoid_var cb1 = notifCb1->_this();
// subscribe to the notification mechanism
receiver1->subscribeNotification(cb1);
sender->startSend();
sender->paceData();
sender->stopSend();
sender->disconnect();
receiver1->closeReceiver();
notifCb1->_remove_ref();
}
catch (AVConnectErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVConnectErrorEx exception catched !"));
AVConnectErrorExImpl ex1(ex);
ex1.log();
}
catch (AVStartSendErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVStartSendErrorEx exception catched !"));
AVStartSendErrorExImpl ex1(ex);
ex1.log();
}
catch (AVPaceDataErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVPaceDataErrorEx exception catched !"));
AVPaceDataErrorExImpl ex1(ex);
ex1.log();
}
catch (AVStopSendErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVStopSendErrorEx exception catched !"));
AVStopSendErrorExImpl ex1(ex);
ex1.log();
}
catch (AVDisconnectErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVDisconnectErrorEx exception catched !"));
AVDisconnectErrorExImpl ex1(ex);
ex1.log();
}
catch (AVCloseReceiverErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVCloseReceiverErrorEx exception catched !"));
AVCloseReceiverErrorExImpl ex1(ex);
ex1.log();
}
catch (ACSErrTypeCommon::CORBAProblemEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "CORBAProblemEx exception catched !"));
ACSErrTypeCommon::CORBAProblemExImpl ex1(ex);
ex1.log();
}
catch (AVNotificationMechanismErrorEx & ex)
{
ACS_SHORT_LOG((LM_ERROR, "AVNotificationMechanismErrorEx exception catched !"));
AVNotificationMechanismErrorExImpl ex1(ex);
ex1.log();
}
catch(...)
{
ACS_SHORT_LOG((LM_ERROR,"UNKNOWN exception catched!"));
}
//We release our component and logout from manager
client.manager()->release_component(client.handle(), "BulkDataNotifReceiver1");
client.manager()->release_component(client.handle(), "BulkDataNotifReceiver");
client.manager()->release_component(client.handle(), "BulkDataDistributer");
client.manager()->release_component(client.handle(), "BulkDataNotifSender");
client.logout();
ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));
ACE_OS::sleep(3);
return 0;
}
示例3: main
/**
* A client to send alarms: it expects to find the number of alarm to send
* as a parameter in the command line.
* As an option, it is also possible to set in the command line the
* fault family and the fault member.
* By default the fault family is "ALCLIENT" and the Fault Member is (ALARM).
* The fault code is always set to 1.
* For each alarm to send a triplet like <ALCLIENT, ALARM_1, 1> is created.
* <P>
* For each alarm, the process activates it and then terminates it.
* First all the alarms are activated then terminated.
* <P>
* The purposes of this process are:
* <UL>
* <LI>Check if sending alarms from a client works
* <LI>have a client that sends alarms from the command line
* <LI>allow to investigate problems in the sources without the complexity of the container
* <UL>
*/
int main(int argc, char *argv[])
{
// Checks command-line arguments.
if (argc !=2 && argc!=4)
{
ACS_SHORT_LOG((LM_INFO, "Usage: %s <num. of alarms to send> [<FaultFamily Fault_Member>]", argv[0]));
return -1;
}
//Creates and initializes the SimpleClient object
SimpleClient client;
if (client.init(argc,argv) == 0)
{
ACE_DEBUG((LM_DEBUG,"Cannot init client"));
return -1;
}
else
{
//Must log into manager before we can really do anything
client.login();
}
// Get the number of alarms to send
int alarmsToSend = (int)strtof(argv[1],NULL);
if (alarmsToSend==0) {
// It can happen if the user set 0 as param or if the conversion made
// by strtof failed
ACS_SHORT_LOG((LM_ERROR, "%d alarms to send: nothing to do. Check val of first param (%s). Is it a number?", alarmsToSend,argv[1]));
return -1;
}
// Init the alarm system factory
ACSAlarmSystemInterfaceFactory::init(client.manager());
ACS_SHORT_LOG((LM_DEBUG, "ACSAlarmSystemInterfaceFactory initialized"));
std::string FF="ALCLIENT";
std::string FM="ALARM";
const int FC=1;
if (argc==4) {
FF=argv[2];
FM=argv[3];
}
ACS_SHORT_LOG((LM_INFO, "Generating %d alarms with triplets like <%s, %s_n, 1>", alarmsToSend,FF.c_str(), FM.c_str()));
// create the AlarmSystemInterface
auto_ptr<acsalarm::AlarmSystemInterface> alarmSource(ACSAlarmSystemInterfaceFactory::createSource());
ACS_SHORT_LOG((LM_DEBUG, "Source created"));
ACS_SHORT_LOG((LM_INFO, "Sending ACTIVE alarms"));
for (int t=0; t<alarmsToSend; t++) {
char tempStr[8];
sprintf(tempStr,"%d",t);
std::string fmTosend=FM;
fmTosend+='_';
fmTosend+=tempStr;
sendAlarm(alarmSource.get(),FF,fmTosend,FC,true);
}
sleep(5);
ACS_SHORT_LOG((LM_INFO, "Sending TERMINATE alarms"));
for (int t=0; t<alarmsToSend; t++) {
char tempStr[8];
sprintf(tempStr,"%d",t);
std::string fmTosend=FM;
fmTosend+='_';
fmTosend+=tempStr;
sendAlarm(alarmSource.get(),FF,fmTosend,FC,false);
}
auto_ptr<acsalarm::AlarmSystemInterface> tstSource(ACSAlarmSystemInterfaceFactory::createSource());
// ACSAlarmSystemInterfaceFactory::done();
client.logout();
ACS_SHORT_LOG((LM_INFO, "%s done.",argv[0]));
return 0;
}
示例4: main
//.........这里部分代码省略.........
{
return -1;
}
else
{
client.login();
}
ACS_SHORT_LOG((LM_INFO, "Getting Component"));
try
{
// obtain the reference to the SAMP (factory) object
acssamp::Samp_var foo = client.get_object<acssamp::Samp>("SAMP1", 0, true);
if (!CORBA::is_nil(foo.in()))
{
ACS_SHORT_LOG((LM_DEBUG, "Got samp descriptor()."));
// calls the initSampObj to create dynamically a new sampling object
acssamp::SampObj_ptr fooNew =
foo->initSampObj("LAMP1","brightness",samplingFrequency,reportRate);
ACS_SHORT_LOG((LM_INFO,"*** Start to sample ***"));
ACS_SHORT_LOG((LM_INFO,"Not Channel: %s",fooNew->getChannelName()));
ACS_SHORT_LOG((LM_INFO,"Sleeping 15 seconds to allow NC Client connection ..."));
ACE_OS::sleep(15);
ACS_SHORT_LOG((LM_INFO," ... done"));
// starts the sampling
fooNew->start();
cout << "Infinite loop started; press Ctrl-C to stop it ..." << endl;
while(endme)
ACE_OS::sleep(1);
cout << "... out of the loop!" << endl;
// stop and clen-up everything
fooNew->stop();
ACE_OS::sleep(2);
fooNew->destroy();
CORBA::release(fooNew);
}
} /* end main try */
catch (OutOfBoundsEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "OutOfBoundsEx exception catched !"));
OutOfBoundsExImpl err(ex);
err.log();
}
catch (CouldntAccessComponentEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "CouldntAccessComponentEx exception catched !"));
CouldntAccessComponentExImpl err(ex);
err.log();
}
catch (CouldntAccessPropertyEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "CouldntAccessPropertyEx exception catched !"));
CouldntAccessPropertyExImpl err(ex);
err.log();
}
catch (CouldntCreateObjectEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "CouldntCreateObjectEx exception catched !"));
CouldntCreateObjectExImpl err(ex);
err.log();
}
catch (TypeNotSupportedEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "TypeNotSupportedEx exception catched !"));
TypeNotSupportedExImpl err(ex);
err.log();
}
catch (...)
{
ACS_SHORT_LOG((LM_INFO, "XXXXXXXX Exception ... catched !"));
// ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "main");
}
/// We release our Ccomponent and logout from the Manager
client.manager()->release_component(client.handle(), "SAMP1");
client.logout();
/// sleep for 3 sec to allow everytihng to cleanup and stableize
ACE_OS::sleep(3);
return 0;
}
示例5: main
int main(int argc, char *argv[])
{
// Checks command-line arguments.
if (argc < 2)
{
ACS_SHORT_LOG((LM_INFO, "Usage: %s <component name> <options>", argv[0]));
return -1;
}
else
{
ACS_SHORT_LOG((LM_INFO, "Welcome to %s!", argv[0]));
}
//Creates and initializes the SimpleClient object
SimpleClient client;
if (client.init(argc,argv) == 0)
{
ACE_DEBUG((LM_DEBUG,"Cannot init client"));
return -1;
}
else
{
//Must log into manager before we can really do anything
client.login();
}
try
{
//List all components of type "*Mount*" the Manager knows of.
ACS_SHORT_LOG((LM_INFO, "Listing all components of type *Mount*"));
maci::HandleSeq seq;
//See the doxygen documentation for maci.idl to understand what these parameters
//are.
maci::ComponentInfoSeq_var components = client.manager()->get_component_info(client.handle(),
seq,
"*",
"*Mount*",
false);
for (CORBA::ULong i = static_cast<CORBA::ULong>(0); i < components->length(); i++)
{
//just print out all known mount components
ACS_SHORT_LOG((LM_INFO,"%s (%s)", components[i].name.in(), components[i].type.in()));
}
// Now get the specific component we have requested from the command-line
ACS_SHORT_LOG((LM_INFO, "Getting component: %s", argv[1]));
//getComponent can throw an exception if it fails
MOUNT_ACS::Mount_var mount = client.getComponent<MOUNT_ACS::Mount>(argv[1], 0, true);
//Prints the descriptor of the requested component
ACS_SHORT_LOG((LM_DEBUG, "Requesting descriptor()... "));
ACS::CharacteristicComponentDesc_var descriptor = mount->descriptor();
ACS_SHORT_LOG((LM_DEBUG, "Got descriptor()."));
ACS_SHORT_LOG((LM_INFO,"Descriptor:"));
ACS_SHORT_LOG((LM_INFO,"\tname: %s", descriptor->name.in()));
//Get the reference to the actAz double property
ACS_SHORT_LOG((LM_INFO, "Getting component property: %s:actAz", argv[1]));
ACS::ROdouble_var actAz = mount->actAz();
if (actAz.ptr() != ACS::ROdouble::_nil())
{
//Get the current value of the property synchronously
ACSErr::Completion_var completion;
CORBA::Double val = actAz->get_sync(completion.out());
ACS_SHORT_LOG((LM_INFO,"Value: %f", val));
//Create the CBdouble property
ACS_SHORT_LOG((LM_INFO, "Trying to narrow CB for actAz... "));
MyCBdouble myCallback("actAz");
//Activate it as a CORBA object
ACS::CBdouble_var cb = myCallback._this();
ACS_SHORT_LOG((LM_INFO, "OK"));
//Invoke the asynchronous method.
ACS_SHORT_LOG((LM_INFO, "Call get_async for actAz..."));
ACS::CBDescIn desc;
actAz->get_async(cb.in(), desc); //returns control immediately
//Here some other useful things should be done
//while the asyncrhonous reply comes
//...
//...
//...
//Enter main loop and stays there for a fixed amount of time (1s)
//This is done to give the asynchronous method a chance to finish.
ACE_Time_Value tv(1);
client.run(tv);
}//if
}
catch(maciErrType::CannotGetComponentExImpl &_ex) // can be thrown by getComponent<..>(...)
{
_ex.log();
return -1;
}
//.........这里部分代码省略.........
示例6: main
int main(int argc, char *argv[])
{
// Creates and initializes the SimpleClient object
SimpleClient client;
if (client.init(argc,argv) == 0)
{
return -1;
}
else
{
//Must log into manager before we can really do anything
client.login();
}
try
{
// Get the specific component we have requested on the command-line
bulkdata::BulkDataReceiver1Perf_var receiver1 = client.get_object<bulkdata::BulkDataReceiver1Perf>("BulkDataReceiver1Perf", 0, true);
if (CORBA::is_nil (receiver1.in ()))
{
ACS_SHORT_LOG((LM_INFO,"Could not retrieve BulkDataReceiver1Perf Component."));
return -1;
}
bulkdata::BulkDataSenderPerf_var sender = client.get_object<bulkdata::BulkDataSenderPerf>("BulkDataSenderPerf", 0, true);
if (CORBA::is_nil (sender.in ()))
{
ACS_SHORT_LOG((LM_INFO,"Could not retrieve BulkDataSenderPerf Component."));
return -1;
}
sender->connect(receiver1.in());
sender->startSend();
sender->paceData();
sender->stopSend();
sender->disconnect();
receiver1->closeReceiver();
}
catch (AVConnectErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVConnectErrorEx exception catched !"));
AVConnectErrorExImpl ex1(ex);
ex1.log();
}
catch (AVStartSendErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVStartSendErrorEx exception catched !"));
AVStartSendErrorExImpl ex1(ex);
ex1.log();
}
catch (AVPaceDataErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVPaceDataErrorEx exception catched !"));
AVPaceDataErrorExImpl ex1(ex);
ex1.log();
}
catch (AVStopSendErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVStopSendErrorEx exception catched !"));
AVStopSendErrorExImpl ex1(ex);
ex1.log();
}
catch (AVDisconnectErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVDisconnectErrorEx exception catched !"));
AVDisconnectErrorExImpl ex1(ex);
ex1.log();
}
catch (AVCloseReceiverErrorEx & ex)
{
ACS_SHORT_LOG((LM_INFO, "AVCloseReceiverErrorEx exception catched !"));
AVCloseReceiverErrorExImpl ex1(ex);
ex1.log();
}
catch(...)
{
ACS_SHORT_LOG((LM_INFO,"UNKNOWN exception catched!"));
}
//We release our component and logout from manager
client.manager()->release_component(client.handle(), "BulkDataSenderPerf");
ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));
ACE_OS::sleep(3);
client.manager()->release_component(client.handle(), "BulkDataReceiver1Perf");
client.logout();
// ACS_SHORT_LOG((LM_INFO,"Sleeping 3 sec to allow everything to cleanup and stabilize"));
// ACE_OS::sleep(3);
//.........这里部分代码省略.........