本文整理汇总了C++中ice::ObjectPrxPtr::ice_getLocator方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPrxPtr::ice_getLocator方法的具体用法?C++ ObjectPrxPtr::ice_getLocator怎么用?C++ ObjectPrxPtr::ice_getLocator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::ObjectPrxPtr
的用法示例。
在下文中一共展示了ObjectPrxPtr::ice_getLocator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
void
allTests(const Ice::CommunicatorPtr& communicator, const string& ref)
{
ServerManagerPrxPtr manager = ICE_CHECKED_CAST(ServerManagerPrx, communicator->stringToProxy(ref));
TestLocatorPrxPtr locator = ICE_UNCHECKED_CAST(TestLocatorPrx, communicator->getDefaultLocator());
test(manager);
TestLocatorRegistryPrxPtr registry = ICE_CHECKED_CAST(TestLocatorRegistryPrx, locator->getRegistry());
test(registry);
cout << "testing stringToProxy... " << flush;
Ice::ObjectPrxPtr base = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrxPtr base2 = communicator->stringToProxy("test @ TestAdapter");
Ice::ObjectPrxPtr base3 = communicator->stringToProxy("test");
Ice::ObjectPrxPtr base4 = communicator->stringToProxy("ServerManager");
Ice::ObjectPrxPtr base5 = communicator->stringToProxy("test2");
Ice::ObjectPrxPtr base6 = communicator->stringToProxy("test @ ReplicatedAdapter");
cout << "ok" << endl;
cout << "testing ice_locator and ice_getLocator... " << flush;
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
Ice::LocatorPrxPtr anotherLocator = ICE_UNCHECKED_CAST(Ice::LocatorPrx, communicator->stringToProxy("anotherLocator"));
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(ICE_NULLPTR);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getLocator());
base = base->ice_locator(anotherLocator);
test(Ice::proxyIdentityEqual(base->ice_getLocator(), anotherLocator));
communicator->setDefaultLocator(locator);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getLocator(), communicator->getDefaultLocator()));
//
// We also test ice_router/ice_getRouter (perhaps we should add a
// test/Ice/router test?)
//
test(!base->ice_getRouter());
Ice::RouterPrxPtr anotherRouter = ICE_UNCHECKED_CAST(Ice::RouterPrx, communicator->stringToProxy("anotherRouter"));
base = base->ice_router(anotherRouter);
test(Ice::proxyIdentityEqual(base->ice_getRouter(), anotherRouter));
Ice::RouterPrxPtr router = ICE_UNCHECKED_CAST(Ice::RouterPrx, communicator->stringToProxy("dummyrouter"));
communicator->setDefaultRouter(router);
base = communicator->stringToProxy("test @ TestAdapter");
test(Ice::proxyIdentityEqual(base->ice_getRouter(), communicator->getDefaultRouter()));
communicator->setDefaultRouter(0);
base = communicator->stringToProxy("test @ TestAdapter");
test(!base->ice_getRouter());
cout << "ok" << endl;
cout << "starting server... " << flush;
manager->startServer();
cout << "ok" << endl;
cout << "testing checked cast... " << flush;
TestIntfPrxPtr obj = ICE_CHECKED_CAST(TestIntfPrx, base);
test(obj);
TestIntfPrxPtr obj2 = ICE_CHECKED_CAST(TestIntfPrx, base2);
test(obj2);
TestIntfPrxPtr obj3 = ICE_CHECKED_CAST(TestIntfPrx, base3);
test(obj3);
ServerManagerPrxPtr obj4 = ICE_CHECKED_CAST(ServerManagerPrx, base4);
test(obj4);
TestIntfPrxPtr obj5 = ICE_CHECKED_CAST(TestIntfPrx, base5);
test(obj5);
TestIntfPrxPtr obj6 = ICE_CHECKED_CAST(TestIntfPrx, base6);
test(obj6);
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj2->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing [email protected] indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
try
{
obj6->ice_ping();
}
catch(const Ice::LocalException& ex)
{
cerr << ex << endl;
test(false);
}
cout << "ok" << endl;
cout << "testing identity indirect proxy... " << flush;
obj->shutdown();
manager->startServer();
//.........这里部分代码省略.........