本文整理汇总了C++中ice::CommunicatorPtr::stringToIdentity方法的典型用法代码示例。如果您正苦于以下问题:C++ CommunicatorPtr::stringToIdentity方法的具体用法?C++ CommunicatorPtr::stringToIdentity怎么用?C++ CommunicatorPtr::stringToIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::CommunicatorPtr
的用法示例。
在下文中一共展示了CommunicatorPtr::stringToIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allTests
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
Ice::ObjectFactoryPtr factory = new MyObjectFactory;
communicator->addObjectFactory(factory, "::Test::B");
communicator->addObjectFactory(factory, "::Test::C");
communicator->addObjectFactory(factory, "::Test::D");
communicator->addObjectFactory(factory, "::Test::E");
communicator->addObjectFactory(factory, "::Test::F");
communicator->addObjectFactory(factory, "::Test::I");
communicator->addObjectFactory(factory, "::Test::J");
communicator->addObjectFactory(factory, "::Test::H");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
InitialPtr initial = new InitialI(adapter);
adapter->add(initial, communicator->stringToIdentity("initial"));
UnexpectedObjectExceptionTestIPtr uoet = new UnexpectedObjectExceptionTestI;
adapter->add(uoet, communicator->stringToIdentity("uoet"));
InitialPrx allTests(const Ice::CommunicatorPtr&);
allTests(communicator);
// We must call shutdown even in the collocated case for cyclic dependency cleanup
initial->shutdown(Ice::Current());
return EXIT_SUCCESS;
}
示例2: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
IceUtil::TimerPtr timer = new IceUtil::Timer();
communicator->getProperties()->setProperty("TestAdapter1.Endpoints", getTestEndpoint(communicator, 0) + ":udp");
communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Size", "5");
communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Serialize", "0");
Ice::ObjectAdapterPtr adapter1 = communicator->createObjectAdapter("TestAdapter1");
adapter1->add(ICE_MAKE_SHARED(HoldI, timer, adapter1), communicator->stringToIdentity("hold"));
communicator->getProperties()->setProperty("TestAdapter2.Endpoints", getTestEndpoint(communicator, 1) + ":udp");
communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Size", "5");
communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Serialize", "1");
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter2");
adapter2->add(ICE_MAKE_SHARED(HoldI, timer, adapter2), communicator->stringToIdentity("hold"));
adapter1->activate();
adapter2->activate();
TEST_READY
communicator->waitForShutdown();
timer->destroy();
return EXIT_SUCCESS;
}
示例3: 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;
}
示例4: getTestEndpoint
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
#ifdef ICE_CPP11_MAPPING
communicator->getValueFactoryManager()->add(makeFactory<II>(), "::Test::I");
communicator->getValueFactoryManager()->add(makeFactory<JI>(), "::Test::J");
communicator->getValueFactoryManager()->add(makeFactory<HI>(), "::Test::H");
#else
Ice::ValueFactoryPtr factory = new MyValueFactory;
communicator->getValueFactoryManager()->add(factory, "::Test::I");
communicator->getValueFactoryManager()->add(factory, "::Test::J");
communicator->getValueFactoryManager()->add(factory, "::Test::H");
#endif
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(InitialI, adapter), communicator->stringToIdentity("initial"));
adapter->add(ICE_MAKE_SHARED(TestIntfI), communicator->stringToIdentity("test"));
adapter->add(ICE_MAKE_SHARED(UnexpectedObjectExceptionTestI), communicator->stringToIdentity("uoet"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例5: 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;
}
示例6:
void
ServerManagerI::startServer(const Ice::Current&)
{
for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
{
(*i)->waitForShutdown();
(*i)->destroy();
}
_communicators.clear();
//
// Simulate a server: create a new communicator and object
// adapter. The object adapter is started on a system allocated
// port. The configuration used here contains the Ice.Locator
// configuration variable. The new object adapter will register
// its endpoints with the locator and create references containing
// the adapter id instead of the endpoints.
//
Ice::CommunicatorPtr serverCommunicator = Ice::initialize(_initData);
_communicators.push_back(serverCommunicator);
//
// Use fixed port to ensure that OA re-activation doesn't re-use previous port from
// another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
//
{
std::ostringstream os;
os << "default -p " << _nextPort++;
serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", os.str());
}
{
std::ostringstream os;
os << "default -p " << _nextPort++;
serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", os.str());
}
Ice::ObjectAdapterPtr adapter = serverCommunicator->createObjectAdapter("TestAdapter");
Ice::ObjectAdapterPtr adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2");
Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:default -p 12010");
adapter->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
adapter2->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI, adapter, adapter2, _registry);
_registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test")));
_registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test2")));
adapter->add(object, serverCommunicator->stringToIdentity("test3"));
adapter->activate();
adapter2->activate();
}
示例7: 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(new TestIntfI(communicator), communicator->stringToIdentity("test"));
adapter->add(new Test1::WstringClassI, communicator->stringToIdentity("wstring1"));
adapter->add(new Test2::WstringClassI, communicator->stringToIdentity("wstring2"));
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例8: 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(ICE_MAKE_SHARED(ControllerI), communicator->stringToIdentity(os.str()));
}
adapter->activate();
TEST_READY
communicator->waitForShutdown();
return EXIT_SUCCESS;
}
示例9: main
int main(int argc, char* argv[])
{
int status = 0;
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(argc, argv);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints("lcdshow", "default -p 10000");
ram::tortuga::SensorBoardI* board = new ram::tortuga::SensorBoardI();
// Check if the board initialized correctly
if (board->isInitialized()) {
Ice::ObjectPtr object = board;
adapter->add(object, ic->stringToIdentity("SensorBoard"));
adapter->activate();
ic->waitForShutdown();
}
delete board;
} catch (const Ice::Exception& e) {
std::cerr << e << std::endl;
status = 1;
} catch (const char* msg) {
std::cerr << msg << std::endl;
status = 1;
}
if (ic) {
try {
ic->destroy();
} catch (const Ice::Exception& e) {
std::cerr << e << std::endl;
status = 1;
}
}
return status;
}
示例10: catch
int
main(int argc, char* argv[])
{
int status = 0;
Ice::InitializationData id;
id.properties = Ice::createProperties(argc, argv);
id.properties->setProperty("Ice.ThreadPool.Server.Size", "50");
id.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "5000");
// _communicator = Ice::initialize(id);
Ice::CommunicatorPtr ic;
try {
ic = Ice::initialize(id);
Ice::ObjectAdapterPtr adapter
= ic->createObjectAdapterWithEndpoints(
"SimplePrinterAdapter", "default -p 10000"); //默认建立的是tcp 连接
Ice::ObjectPtr object = new PrinterI;
PrinterPrx spPrx = PrinterPrx::uncheckedCast(adapter->add(object, ic->stringToIdentity("SimplePrinter")));
cout << "PrinterPrx:" <<spPrx <<endl;
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)
ic->destroy();
return status;
}
示例11: main
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)
{
std::cerr << e << std::endl;
status = 1;
}
if (ic)
{
try
{
ic->destroy();
}
catch (const Ice::Exception& e)
{
std::cerr << e << std::endl;
status = 1;
}
}
return status;
}
示例12: allTests
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");
communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorI, ""), "");
adapter->addServantLocator(ICE_MAKE_SHARED(ServantLocatorI, "category"), "category");
adapter->add(ICE_MAKE_SHARED(TestI), communicator->stringToIdentity("asm"));
adapter->add(ICE_MAKE_SHARED(TestActivationI), communicator->stringToIdentity("test/activation"));
Test::TestIntfPrxPtr allTests(const CommunicatorPtr&);
allTests(communicator);
return EXIT_SUCCESS;
}
示例13:
void
HelloServiceI::start(const string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& /*args*/)
{
_adapter = communicator->createObjectAdapter(name);
Demo::HelloPtr hello = new HelloI;
_adapter->add(hello, communicator->stringToIdentity("hello"));
_adapter->activate();
}
示例14:
virtual void
findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr& response, const string&,
const Ice::Current& current) const
{
_controller->checkCallPause(current);
Ice::CommunicatorPtr communicator = current.adapter->getCommunicator();
response->ice_response(current.adapter->createDirectProxy(communicator->stringToIdentity("dummy")));
}
示例15: ServantLocatorAMDI
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
communicator->getProperties()->setProperty("Ice.Warn.Dispatch", "0");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->addServantLocator(new ServantLocatorAMDI(""), "");
adapter->addServantLocator(new ServantLocatorAMDI("category"), "category");
adapter->add(new TestAMDI, communicator->stringToIdentity("asm"));
adapter->add(new TestActivationI, communicator->stringToIdentity("test/activation"));
adapter->activate();
TEST_READY
adapter->waitForDeactivate();
return EXIT_SUCCESS;
}