当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectAdapterPtr::remove方法代码示例

本文整理汇总了C++中ice::ObjectAdapterPtr::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectAdapterPtr::remove方法的具体用法?C++ ObjectAdapterPtr::remove怎么用?C++ ObjectAdapterPtr::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ice::ObjectAdapterPtr的用法示例。


在下文中一共展示了ObjectAdapterPtr::remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: catch

void 
Glacier2::FilterManager::destroy()
{
    Ice::ObjectAdapterPtr adapter = _instance->serverObjectAdapter();
    if(adapter)
    {
        try
        {
            if(_categoriesPrx)
            {
                adapter->remove(_categoriesPrx->ice_getIdentity());
            }
        }
        catch(const Exception&)
        {
        }
        try
        {
            if(_adapterIdsPrx)
            {
                adapter->remove(_adapterIdsPrx->ice_getIdentity());
            }
        }
        catch(const Exception&)
        {
        }
        try
        {
            if(_identitiesPrx)
            {
                adapter->remove(_identitiesPrx->ice_getIdentity());
            }
        }
        catch(const Exception&)
        {
        }
    }
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:38,代码来源:FilterManager.cpp

示例2: ule


//.........这里部分代码省略.........
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        try
        {
            adapter->add(obj, communicator->stringToIdentity(""));
        }
        catch(const Ice::IllegalIdentityException& ex)
        {
            test(ex.id.name == "");
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }
        
        try
        {
            adapter->add(0, communicator->stringToIdentity("x"));
        }
        catch(const Ice::IllegalServantException& ex)
        {
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }


        adapter->remove(communicator->stringToIdentity("x"));
        try
        {
            adapter->remove(communicator->stringToIdentity("x"));
            test(false);
        }
        catch(const Ice::NotRegisteredException& ex)
        {
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        adapter->deactivate();
    }
    cout << "ok" << endl;

    cout << "testing servant locator registrations exceptions... " << flush;
    {
        string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ? 
            "127.0.0.1" : "\"0:0:0:0:0:0:0:1\"";
        communicator->getProperties()->setProperty("TestAdapter2.Endpoints", "default -h " + host);
        Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
        Ice::ServantLocatorPtr loc = new ServantLocatorI;
        adapter->addServantLocator(loc, "x");
        try
        {
            adapter->addServantLocator(loc, "x");
            test(false);
        }
        catch(const Ice::AlreadyRegisteredException&)
开发者ID:Jonavin,项目名称:ice,代码行数:67,代码来源:AllTests.cpp

示例3: ule


//.........这里部分代码省略.........
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        try
        {
            adapter->add(obj, communicator->stringToIdentity(""));
        }
        catch(const Ice::IllegalIdentityException& ex)
        {
            test(ex.id.name == "");
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        try
        {
            adapter->add(0, communicator->stringToIdentity("x"));
        }
        catch(const Ice::IllegalServantException& ex)
        {
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        adapter->remove(communicator->stringToIdentity("x"));
        try
        {
            adapter->remove(communicator->stringToIdentity("x"));
            test(false);
        }
        catch(const Ice::NotRegisteredException& ex)
        {
            if(printException)
            {
                Ice::Print printer(communicator->getLogger());
                printer << ex;
            }
        }

        adapter->deactivate();
    }
    cout << "ok" << endl;

    cout << "testing servant locator registrations exceptions... " << flush;
    {
        communicator->getProperties()->setProperty("TestAdapter2.Endpoints", localOAEndpoint);
        Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter2");
        Ice::ServantLocatorPtr loc = ICE_MAKE_SHARED(ServantLocatorI);
        adapter->addServantLocator(loc, "x");
        try
        {
            adapter->addServantLocator(loc, "x");
            test(false);
        }
        catch(const Ice::AlreadyRegisteredException&)
        {
        }
开发者ID:joshmoore,项目名称:ice,代码行数:67,代码来源:AllTests.cpp

示例4: if

int
TalkApp::run(int argc, char*[])
{
    if(argc > 1)
    {
        cerr << appName() << ": too many arguments" << endl;
        return EXIT_FAILURE;
    }

    //
    // Create an object adapter with the name "Talk". Its endpoint is defined
    // in the configuration file 'config'.
    //
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Talk");

    //
    // Install a servant with the well-known identity "peer".
    //
    PeerIPtr incomingPeer = new IncomingPeerI;
    PeerIPtr peer = incomingPeer;
    adapter->add(peer, communicator()->stringToIdentity("peer"));
    adapter->activate();

    usage();

    cout << ">>>> Ready." << endl;

    do
    {
        string s;
        cout << "";
        getline(cin, s);

        if(!s.empty())
        {
            if(s[0] == '/')
            {
                if(s.size() > 8 && s.substr(0, 8) == "/connect")
                {
                    string::size_type sp = s.find(' ');
                    if(sp == string::npos)
                    {
                        usage();
                        continue;
                    }
                    sp = s.find_first_not_of(' ', sp);
                    if(sp == string::npos)
                    {
                        usage();
                        continue;
                    }
                    string addr = s.substr(sp);

                    //
                    // Generate a UUID for our callback servant. We have to pass this identity to
                    // the remote peer so that it can invoke callbacks on the servant over a
                    // bidirectional connection.
                    //
                    Ice::Identity id = communicator()->stringToIdentity(IceUtil::generateUUID());
                    PeerIPtr servant;

                    try
                    {
                        //
                        // Create a proxy for the remote peer using the address given by the user
                        // and the well-known UUID for the talk service.
                        //
                        Talk::PeerPrx prx = Talk::PeerPrx::uncheckedCast(
                            communicator()->stringToProxy(
                                "peer:bt -a \"" + addr + "\" -u 6a193943-1754-4869-8d0a-ddc5f9a2b294"));
                        cout << ">>>> Connecting to " << addr << endl;

                        //
                        // Configure an object adapter for the connection and add the servant. This enables
                        // us to receive callbacks via this connection. Calling ice_getConnection() blocks
                        // until the connection to the peer is established.
                        //
                        Ice::ConnectionPtr con = prx->ice_getConnection();
                        con->setAdapter(adapter);
                        servant = new OutgoingPeerI(adapter, id, prx);
                        adapter->add(servant, id);

                        //
                        // Now we're ready to notify the peer that we'd like to connect.
                        //
                        prx->connect(id);
                        peer = servant;
                        cout << ">>>> Connected to " << addr << endl;
                    }
                    catch(const Ice::Exception& ex)
                    {
                        cout << ">>>> " << ex << endl;
                        if(servant)
                        {
                            adapter->remove(id);
                        }
                    }
                }
                else if(s == "/disconnect")
                {
//.........这里部分代码省略.........
开发者ID:RonsonNamek,项目名称:ice-demos,代码行数:101,代码来源:App.cpp


注:本文中的ice::ObjectAdapterPtr::remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。