本文整理汇总了C++中ice::CommunicatorPtr::waitForShutdown方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr::waitForShutdown方法的具体用法?C++ CommunicatorPtr::waitForShutdown怎么用?C++ CommunicatorPtr::waitForShutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::CommunicatorPtr
的用法示例。
在下文中一共展示了CommunicatorPtr::waitForShutdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp"));
communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter");
#ifdef ICE_CPP11_MAPPING
shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test"));
#else
PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get());
#endif
assert(plugin);
ConfigurationPtr configuration = plugin->getConfiguration();
BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration);
adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), communicator->stringToIdentity("background"));
adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), communicator->stringToIdentity("locator"));
adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), communicator->stringToIdentity("router"));
adapter->activate();
adapter2->add(backgroundController, communicator->stringToIdentity("backgroundController"));
adapter2->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例2: catch
int
main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter =
ic->createObjectAdapterWithEndpoints("SimplePrinterAdapter", "default -p 10000");
Ice::ObjectPtr object = new PrinterI;
adapter->add(object, ic->stringToIdentity("SimplePrinter"));
adapter->activate();
ic->waitForShutdown();
} catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
} catch (const char* msg) {
cerr << msg << endl;
status = 1;
}
if (ic) {
try {
ic->destroy();
} catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
}
}
return status;
}
示例3: atoi
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
int num = argc == 2 ? atoi(argv[1]) : 0;
{
ostringstream os;
os << "default -p " << (12010 + num);
properties->setProperty("ControlAdapter.Endpoints", os.str());
}
{
ostringstream os;
os << "control" << num;
properties->setProperty("ControlAdapter.AdapterId", os.str());
}
properties->setProperty("ControlAdapter.ThreadPool.Size", "1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter");
{
ostringstream os;
os << "controller" << num;
adapter->add(new ControllerI, communicator->stringToIdentity(os.str()));
}
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例4: main
int main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
if (argc != 4) {
cerr << "Usage: " << argv[0] << " servername NameService-host local-port\n";
goto clean_up;
}
// Look up the name service.
ostringstream ns_formatter;
ns_formatter << "NameService:tcp -h " << argv[2] << " -p 9010";
Ice::ObjectPrx base =
ic->stringToProxy(ns_formatter.str().c_str());
NameServicePrx ns = NameServicePrx::checkedCast(base);
if (!ns)
throw "Invalid NameService";
// Create local chat display object and support infrastructure.
ostringstream server_formatter;
server_formatter << "tcp -p " << argv[3];
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints(
"ChatterAdapter", server_formatter.str().c_str());
Ice::ObjectPtr object = new RoomManager_impl(adapter);
Ice::ObjectPrx server =
adapter->add(object, ic->stringToIdentity("RoomManager"));
adapter->activate();
// Register object.
// ns->registerName(argv[1], server);
ic->waitForShutdown();
}
catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
}
catch (const char* msg) {
cerr << msg << endl;
status = 1;
}
clean_up:
// We must call ic->destroy() even if an exception is throw above.
if (ic) {
try {
ic->destroy();
}
catch (const Ice::Exception& e) {
cerr << e << endl;
status = 1;
}
}
return status;
}
示例5: InitialI
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(new InitialI(), communicator->stringToIdentity("initial"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例6: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(InitialI), Ice::stringToIdentity("initial"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例7:
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例8: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
string endpt = getTestEndpoint(communicator, 0);
communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpt + ":udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), communicator->stringToIdentity("test"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例9:
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::Identity id = communicator->stringToIdentity("factory");
adapter->add(new RemoteCommunicatorFactoryI, id);
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例10:
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "tcp -p 12010");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::Identity id = communicator->stringToIdentity("factory");
adapter->add(ICE_MAKE_SHARED(ServerFactoryI), id);
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例11: main
int main(int argc, char **argv)
{
Ice::CommunicatorPtr ic;
int status = 0;
std::string port("20000");
if (argc > 1) {
try {
std::stoul(argv[1]);
}
catch (const std::exception& e) {
std::cerr << "Invalid port number: " << argv[1] << '\n';
return 1;
}
port = argv[1];
}
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints("PocketSphinxServerAdapter", "default -p " + port);
PocketSphinxServer* srv = new PocketSphinxServer;
std::cout << "init done\n";
Ice::ObjectPtr object = srv;
adapter->add(object, ic->stringToIdentity("PocketSphinxServer"));
adapter->activate();
ic->waitForShutdown();
}
catch (const Ice::Exception& e) {
std::cerr << e << std::endl;
status = 1;
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
status = 1;
}
catch (...) {
status = 1;
}
if (ic) {
try {
ic->destroy();
}
catch (const Ice::Exception& e) {
std::cerr << e << std::endl;
status = 1;
}
}
return status;
}
示例12: main
int main(int argc, char** argv){
killed=false;
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = exitApplication;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
Ice::PropertiesPtr prop;
std::string componentPrefix("myComponent");
try{
ic = Ice::initialize(argc,argv);
prop = ic->getProperties();
}
catch (const Ice::Exception& ex) {
std::cerr << ex << std::endl;
return 1;
}
catch (const char* msg) {
std::cerr <<"Error :" << msg << std::endl;
return 1;
}
std::string Endpoints = prop->getProperty(componentPrefix + ".Endpoints");
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints(componentPrefix, Endpoints);
// for each interface:
std::string objPrefix="myInterface";
std::string Name = "pointcloud1";
std::cout << "Creating pointcloud1 " << Name << std::endl;
interface1 = new myClassI();
adapter->add(interface1, ic->stringToIdentity(Name));
//starting the adapter
adapter->activate();
ic->waitForShutdown();
if (!killed)
exitApplication(1);
return 0;
}
示例13: TestIntfI
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(new TestIntfI(communicator), communicator->stringToIdentity("test"));
adapter->add(new Test1::WstringClassI, communicator->stringToIdentity("wstring1"));
adapter->add(new Test2::WstringClassI, communicator->stringToIdentity("wstring2"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例14: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
properties->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + " -t 2000");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("Test"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例15: ThrowerI
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
properties->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new ThrowerI();
adapter->add(object, communicator->stringToIdentity("thrower"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
}