本文整理汇总了C++中ice::EndpointSeq::size方法的典型用法代码示例。如果您正苦于以下问题:C++ EndpointSeq::size方法的具体用法?C++ EndpointSeq::size怎么用?C++ EndpointSeq::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::EndpointSeq
的用法示例。
在下文中一共展示了EndpointSeq::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
static PyObject*
adapterGetPublishedEndpoints(ObjectAdapterObject* self)
{
assert(self->adapter);
Ice::EndpointSeq endpoints;
try
{
endpoints = (*self->adapter)->getPublishedEndpoints();
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}
int count = static_cast<int>(endpoints.size());
PyObjectHandle result = PyTuple_New(count);
int i = 0;
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p, ++i)
{
PyObjectHandle endp = createEndpoint(*p);
if(!endp.get())
{
return 0;
}
PyTuple_SET_ITEM(result.get(), i, endp.release()); // PyTuple_SET_ITEM steals a reference.
}
return result.release();
}
示例2: run
int FleCSServer::run(int, char*[])
{
try
{
shutdownOnInterrupt();
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("FleCS");
FleCS::C2SPtr c2s = new C2SI;
adapter->add(c2s, communicator()->stringToIdentity("c2s"));
FleCS::SM2SPtr sm2s = new SM2SI;
adapter->add(sm2s, communicator()->stringToIdentity("sm2s"));
adapter->activate();
// Notify master that a server is on.
//
// No deadlock as long as the master do not notify the originating server.
// server --(join)--> master --(notify)--> all other servers.
//
// Master needs to make sure that join service is serialized.
FleCS::MasterPrx& m_prx = GetMasterProxy();
// Ask to join the system. Give my endpoint and get the existing
// servers.
Ice::EndpointSeq eps = adapter->getEndpoints();
// Assume that this server has one endpoint.
if (eps.size() != 1)
{
_LOG("Unexpected");
exit(EXIT_FAILURE);
}
vector<string> existingServers;
m_prx->Join((*eps.begin())->toString(), existingServers);
AddServers(existingServers);
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}
catch (const exception& e)
{
_LOG(e.what());
}
return EXIT_FAILURE;
}
示例3: is
void
allTests(Test::TestHelper* helper)
{
Ice::CommunicatorPtr communicator = helper->communicator();
cout << "testing proxy endpoint information... " << flush;
{
Ice::ObjectPrxPtr p1 =
communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:"
"udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:"
"opaque -e 1.8 -t 100 -v ABCD");
Ice::EndpointSeq endps = p1->ice_getEndpoints();
Ice::EndpointInfoPtr info = endps[0]->getInfo();
Ice::TCPEndpointInfoPtr ipEndpoint = getTCPEndpointInfo(info);
test(ipEndpoint);
test(ipEndpoint->host == "tcphost");
test(ipEndpoint->port == 10000);
test(ipEndpoint->timeout == 1200);
#if !defined(ICE_OS_UWP)
test(ipEndpoint->sourceAddress == "10.10.10.10");
#endif
test(ipEndpoint->compress);
test(!ipEndpoint->datagram());
test((ipEndpoint->type() == Ice::TCPEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::SSLEndpointType && ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ipEndpoint->secure()));
test((ipEndpoint->type() == Ice::TCPEndpointType && ICE_DYNAMIC_CAST(Ice::TCPEndpointInfo, info)) ||
(ipEndpoint->type() == Ice::SSLEndpointType && ICE_DYNAMIC_CAST(IceSSL::EndpointInfo, info)) ||
(ipEndpoint->type() == Ice::WSEndpointType && ICE_DYNAMIC_CAST(Ice::WSEndpointInfo, info)) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ICE_DYNAMIC_CAST(Ice::WSEndpointInfo, info)));
Ice::UDPEndpointInfoPtr udpEndpoint = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, endps[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "udphost");
test(udpEndpoint->port == 10001);
#if !defined(ICE_OS_UWP)
test(udpEndpoint->sourceAddress == "10.10.10.10");
#endif
test(udpEndpoint->mcastInterface == "eth0");
test(udpEndpoint->mcastTtl == 5);
test(udpEndpoint->timeout == -1);
test(!udpEndpoint->compress);
test(!udpEndpoint->secure());
test(udpEndpoint->datagram());
test(udpEndpoint->type() == Ice::UDPEndpointType);
Ice::OpaqueEndpointInfoPtr opaqueEndpoint = ICE_DYNAMIC_CAST(Ice::OpaqueEndpointInfo, endps[2]->getInfo());
test(opaqueEndpoint);
Ice::EncodingVersion rev;
rev.major = 1;
rev.minor = 8;
test(opaqueEndpoint->rawEncoding == rev);
}
cout << "ok" << endl;
string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host");
#ifdef ICE_OS_UWP
bool uwp = true;
#else
bool uwp = false;
#endif
if(!uwp || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" &&
communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss"))
{
cout << "test object adapter endpoint information... " << flush;
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints",
"default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::EndpointSeq endpoints = adapter->getEndpoints();
test(endpoints.size() == 2);
Ice::EndpointSeq publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
Ice::TCPEndpointInfoPtr ipEndpoint = getTCPEndpointInfo(endpoints[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->type() == Ice::TCPEndpointType || ipEndpoint->type() == Ice::SSLEndpointType ||
ipEndpoint->type() == Ice::WSEndpointType || ipEndpoint->type() == Ice::WSSEndpointType);
test(ipEndpoint->host == "127.0.0.1");
test(ipEndpoint->port > 0);
test(ipEndpoint->timeout == 15000);
Ice::UDPEndpointInfoPtr udpEndpoint = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, endpoints[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "127.0.0.1");
test(udpEndpoint->datagram());
test(udpEndpoint->port > 0);
endpoints.pop_back();
test(endpoints.size() == 1);
adapter->setPublishedEndpoints(endpoints);
publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
adapter->destroy();
//.........这里部分代码省略.........
示例4: test
void
allTests(const Ice::CommunicatorPtr& comm)
{
IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast(
comm->stringToProxy(comm->getDefaultLocator()->ice_getIdentity().category + "/Registry"));
AdminSessionPrx session = registry->createAdminSession("foo", "bar");
session->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::HeartbeatAlways);
AdminPrx admin = session->getAdmin();
test(admin);
map<string, string> params;
params.clear();
params["id"] = "Master";
params["replicaName"] = "";
params["port"] = "12050";
instantiateServer(admin, "IceGridRegistry", params);
params.clear();
params["id"] = "Slave1";
params["replicaName"] = "Slave1";
params["port"] = "12051";
instantiateServer(admin, "IceGridRegistry", params);
params.clear();
params["id"] = "Slave2";
params["replicaName"] = "Slave2";
params["port"] = "12052";
instantiateServer(admin, "IceGridRegistry", params);
Ice::LocatorPrx masterLocator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Master:default -p 12050"));
Ice::LocatorPrx slave1Locator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Slave1:default -p 12051"));
Ice::LocatorPrx slave2Locator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator-Slave2:default -p 12052"));
Ice::LocatorPrx replicatedLocator =
Ice::LocatorPrx::uncheckedCast(comm->stringToProxy("RepTestIceGrid/Locator:default -p 12050:default -p 12051"));
AdminPrx masterAdmin, slave1Admin, slave2Admin;
admin->startServer("Master");
masterAdmin = createAdminSession(masterLocator, "");
admin->startServer("Slave1");
slave1Admin = createAdminSession(slave1Locator, "Slave1");
//
// Test replication and well-known objects:
//
// - Locator interface
// - Query interface
//
// - Registry object
// - RegistryUserAccountMapper
// - SessionManager/SSLSessionManager
// - AdminSessionManager/AdminSSLSessionManager
//
cout << "testing replicated locator and query interface... " << flush;
{
Ice::EndpointSeq endpoints;
ObjectInfo info;
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
ObjectInfo info1 = slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
test(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) == info);
test(info.type == Ice::Locator::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 2);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
test(endpoints[1]->toString().find("-p 12051") != string::npos);
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Query"));
test(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Query")) == info);
test(info.type == IceGrid::Query::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 2);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
test(endpoints[1]->toString().find("-p 12051") != string::npos);
admin->startServer("Slave2");
slave2Admin = createAdminSession(slave2Locator, "Slave2");
info = masterAdmin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator"));
// We eventually need to wait here for the update of the replicated objects to propagate to the replica.
int nRetry = 0;
while(slave1Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) != info && nRetry < maxRetry)
{
IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(sleepTime));
++nRetry;
}
test(slave2Admin->getObjectInfo(Ice::stringToIdentity("RepTestIceGrid/Locator")) == info);
test(info.type == Ice::Locator::ice_staticId());
endpoints = info.proxy->ice_getEndpoints();
test(endpoints.size() == 3);
test(endpoints[0]->toString().find("-p 12050") != string::npos);
//.........这里部分代码省略.........
示例5: is
void
allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "testing proxy endpoint information... " << flush;
{
Ice::ObjectPrx p1 =
communicator->stringToProxy("test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:"
"udp -h udphost -p 10001 --interface eth0 --ttl 5 --sourceAddress 10.10.10.10:"
"opaque -e 1.8 -t 100 -v ABCD");
Ice::EndpointSeq endps = p1->ice_getEndpoints();
Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endps[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->host == "tcphost");
test(ipEndpoint->port == 10000);
test(ipEndpoint->timeout == 1200);
#if !defined(ICE_OS_WINRT)
test(ipEndpoint->sourceAddress == "10.10.10.10");
#endif
test(ipEndpoint->compress);
test(!ipEndpoint->datagram());
test((ipEndpoint->type() == Ice::TCPEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == IceSSL::EndpointType && ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSEndpointType && !ipEndpoint->secure()) ||
(ipEndpoint->type() == Ice::WSSEndpointType && ipEndpoint->secure()));
test((ipEndpoint->type() == Ice::TCPEndpointType && Ice::TCPEndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == IceSSL::EndpointType && IceSSL::EndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == Ice::WSEndpointType && Ice::EndpointInfoPtr::dynamicCast(ipEndpoint)) ||
(ipEndpoint->type() == Ice::WSSEndpointType && Ice::EndpointInfoPtr::dynamicCast(ipEndpoint)));
Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endps[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == "udphost");
test(udpEndpoint->port == 10001);
#if !defined(ICE_OS_WINRT)
test(udpEndpoint->sourceAddress == "10.10.10.10");
#endif
test(udpEndpoint->mcastInterface == "eth0");
test(udpEndpoint->mcastTtl == 5);
test(udpEndpoint->timeout == -1);
test(!udpEndpoint->compress);
test(!udpEndpoint->secure());
test(udpEndpoint->datagram());
test(udpEndpoint->type() == Ice::UDPEndpointType);
Ice::OpaqueEndpointInfoPtr opaqueEndpoint = Ice::OpaqueEndpointInfoPtr::dynamicCast(endps[2]->getInfo());
test(opaqueEndpoint);
Ice::EncodingVersion rev;
rev.major = 1;
rev.minor = 8;
test(opaqueEndpoint->rawEncoding == rev);
}
cout << "ok" << endl;
string defaultHost = communicator->getProperties()->getProperty("Ice.Default.Host");
cout << "test object adapter endpoint information... " << flush;
{
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -t 15000:udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::EndpointSeq endpoints = adapter->getEndpoints();
test(endpoints.size() == 2);
Ice::EndpointSeq publishedEndpoints = adapter->getPublishedEndpoints();
test(endpoints == publishedEndpoints);
Ice::IPEndpointInfoPtr ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(endpoints[0]->getInfo());
test(ipEndpoint);
test(ipEndpoint->type() == Ice::TCPEndpointType || ipEndpoint->type() == IceSSL::EndpointType ||
ipEndpoint->type() == Ice::WSEndpointType || ipEndpoint->type() == Ice::WSSEndpointType);
test(ipEndpoint->host == defaultHost);
test(ipEndpoint->port > 0);
test(ipEndpoint->timeout == 15000);
Ice::UDPEndpointInfoPtr udpEndpoint = Ice::UDPEndpointInfoPtr::dynamicCast(endpoints[1]->getInfo());
test(udpEndpoint);
test(udpEndpoint->host == defaultHost);
test(udpEndpoint->datagram());
test(udpEndpoint->port > 0);
adapter->destroy();
communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p 12020");
communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020");
adapter = communicator->createObjectAdapter("TestAdapter");
endpoints = adapter->getEndpoints();
test(endpoints.size() >= 1);
publishedEndpoints = adapter->getPublishedEndpoints();
test(publishedEndpoints.size() == 1);
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast((*p)->getInfo());
test(ipEndpoint->port == 12020);
}
ipEndpoint = Ice::IPEndpointInfoPtr::dynamicCast(publishedEndpoints[0]->getInfo());
test(ipEndpoint->host == "127.0.0.1");
test(ipEndpoint->port == 12020);
//.........这里部分代码省略.........