本文整理汇总了C++中ice::ObjectAdapterPtr::removeFacet方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectAdapterPtr::removeFacet方法的具体用法?C++ ObjectAdapterPtr::removeFacet怎么用?C++ ObjectAdapterPtr::removeFacet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::ObjectAdapterPtr
的用法示例。
在下文中一共展示了ObjectAdapterPtr::removeFacet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test
GPrxPtr
allTests(const Ice::CommunicatorPtr& communicator)
{
#ifdef ICE_OS_UWP
bool uwp = true;
#else
bool uwp = false;
#endif
cout << "testing Ice.Admin.Facets property... " << flush;
test(communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets").empty());
communicator->getProperties()->setProperty("Ice.Admin.Facets", "foobar");
Ice::StringSeq facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 1 && facetFilter[0] == "foobar");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "foo\\'bar");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 1 && facetFilter[0] == "foo'bar");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' toto 'titi'");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 3 && facetFilter[0] == "foo bar" && facetFilter[1] == "toto" &&
facetFilter[2] == "titi");
communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar\\' toto' 'titi'");
facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
test(facetFilter.size() == 2 && facetFilter[0] == "foo bar' toto" && facetFilter[1] == "titi");
// communicator->getProperties()->setProperty("Ice.Admin.Facets", "'foo bar' 'toto titi");
// facetFilter = communicator->getProperties()->getPropertyAsList("Ice.Admin.Facets");
// test(facetFilter.size() == 0);
communicator->getProperties()->setProperty("Ice.Admin.Facets", "");
cout << "ok" << endl;
cout << "testing facet registration exceptions... " << flush;
string localOAEndpoint;
{
ostringstream ostr;
if(communicator->getProperties()->getProperty("Ice.Default.Protocol") == "bt")
{
ostr << "default -a *";
}
else
{
ostr << "default -h *";
}
localOAEndpoint = ostr.str();
}
communicator->getProperties()->setProperty("FacetExceptionTestAdapter.Endpoints", localOAEndpoint);
if(uwp || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" &&
communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss"))
{
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter");
Ice::ObjectPtr obj = ICE_MAKE_SHARED(EmptyI);
adapter->add(obj, Ice::stringToIdentity("d"));
adapter->addFacet(obj, Ice::stringToIdentity("d"), "facetABCD");
try
{
adapter->addFacet(obj, Ice::stringToIdentity("d"), "facetABCD");
test(false);
}
catch(const Ice::AlreadyRegisteredException&)
{
}
adapter->removeFacet(Ice::stringToIdentity("d"), "facetABCD");
try
{
adapter->removeFacet(Ice::stringToIdentity("d"), "facetABCD");
test(false);
}
catch(const Ice::NotRegisteredException&)
{
}
cout << "ok" << endl;
cout << "testing removeAllFacets... " << flush;
Ice::ObjectPtr obj1 = ICE_MAKE_SHARED(EmptyI);
Ice::ObjectPtr obj2 = ICE_MAKE_SHARED(EmptyI);
adapter->addFacet(obj1, Ice::stringToIdentity("id1"), "f1");
adapter->addFacet(obj2, Ice::stringToIdentity("id1"), "f2");
Ice::ObjectPtr obj3 = ICE_MAKE_SHARED(EmptyI);
adapter->addFacet(obj1, Ice::stringToIdentity("id2"), "f1");
adapter->addFacet(obj2, Ice::stringToIdentity("id2"), "f2");
adapter->addFacet(obj3, Ice::stringToIdentity("id2"), "");
Ice::FacetMap fm = adapter->removeAllFacets(Ice::stringToIdentity("id1"));
test(fm.size() == 2);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
try
{
adapter->removeAllFacets(Ice::stringToIdentity("id1"));
test(false);
}
catch(const Ice::NotRegisteredException&)
{
}
fm = adapter->removeAllFacets(Ice::stringToIdentity("id2"));
test(fm.size() == 3);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
test(fm[""] == obj3);
cout << "ok" << endl;
adapter->deactivate();
//.........这里部分代码省略.........
示例2: tprintf
GPrx
allTests(const Ice::CommunicatorPtr& communicator)
{
tprintf("testing facet registration exceptions... ");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("FacetExceptionTestAdapter");
Ice::ObjectPtr obj = new EmptyI;
adapter->add(obj, communicator->stringToIdentity("d"));
adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
try
{
adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
test(false);
}
catch(Ice::AlreadyRegisteredException&)
{
}
adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
try
{
adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
test(false);
}
catch(Ice::NotRegisteredException&)
{
}
tprintf("ok\n");
tprintf("testing removeAllFacets... ");
Ice::ObjectPtr obj1 = new EmptyI;
Ice::ObjectPtr obj2 = new EmptyI;
adapter->addFacet(obj1, communicator->stringToIdentity("id1"), "f1");
adapter->addFacet(obj2, communicator->stringToIdentity("id1"), "f2");
Ice::ObjectPtr obj3 = new EmptyI;
adapter->addFacet(obj1, communicator->stringToIdentity("id2"), "f1");
adapter->addFacet(obj2, communicator->stringToIdentity("id2"), "f2");
adapter->addFacet(obj3, communicator->stringToIdentity("id2"), "");
Ice::FacetMap fm = adapter->removeAllFacets(communicator->stringToIdentity("id1"));
test(fm.size() == 2);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
try
{
adapter->removeAllFacets(communicator->stringToIdentity("id1"));
test(false);
}
catch(Ice::NotRegisteredException&)
{
}
fm = adapter->removeAllFacets(communicator->stringToIdentity("id2"));
test(fm.size() == 3);
test(fm["f1"] == obj1);
test(fm["f2"] == obj2);
test(fm[""] == obj3);
tprintf("ok\n");
adapter->deactivate();
tprintf("testing stringToProxy... ");
string ref = communicator->getProperties()->getPropertyWithDefault("Facets.Proxy", "d:default -p 12010 -t 10000");
Ice::ObjectPrx db = communicator->stringToProxy(ref);
test(db);
tprintf("ok\n");
tprintf("testing unchecked cast... ");
Ice::ObjectPrx prx = Ice::ObjectPrx::uncheckedCast(db);
test(prx->ice_getFacet().empty());
prx = Ice::ObjectPrx::uncheckedCast(db, "facetABCD");
test(prx->ice_getFacet() == "facetABCD");
Ice::ObjectPrx prx2 = Ice::ObjectPrx::uncheckedCast(prx);
test(prx2->ice_getFacet() == "facetABCD");
Ice::ObjectPrx prx3 = Ice::ObjectPrx::uncheckedCast(prx, "");
test(prx3->ice_getFacet().empty());
DPrx d = Test::DPrx::uncheckedCast(db);
test(d->ice_getFacet().empty());
DPrx df = Test::DPrx::uncheckedCast(db, "facetABCD");
test(df->ice_getFacet() == "facetABCD");
DPrx df2 = Test::DPrx::uncheckedCast(df);
test(df2->ice_getFacet() == "facetABCD");
DPrx df3 = Test::DPrx::uncheckedCast(df, "");
test(df3->ice_getFacet().empty());
tprintf("ok\n");
tprintf("testing checked cast... ");
prx = Ice::ObjectPrx::checkedCast(db);
test(prx->ice_getFacet().empty());
prx = Ice::ObjectPrx::checkedCast(db, "facetABCD");
test(prx->ice_getFacet() == "facetABCD");
prx2 = Ice::ObjectPrx::checkedCast(prx);
test(prx2->ice_getFacet() == "facetABCD");
prx3 = Ice::ObjectPrx::checkedCast(prx, "");
test(prx3->ice_getFacet().empty());
d = Test::DPrx::checkedCast(db);
test(d->ice_getFacet().empty());
df = Test::DPrx::checkedCast(db, "facetABCD");
test(df->ice_getFacet() == "facetABCD");
df2 = Test::DPrx::checkedCast(df);
test(df2->ice_getFacet() == "facetABCD");
df3 = Test::DPrx::checkedCast(df, "");
test(df3->ice_getFacet().empty());
tprintf("ok\n");
//.........这里部分代码省略.........