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


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

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


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

示例1: SessionServantManager

Ice::ObjectAdapterPtr
RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, 
                                    const Ice::ObjectPtr& router,
                                    const IceGrid::LocatorPrx& locator)
{
    Ice::PropertiesPtr properties = _communicator->getProperties();

    Ice::ObjectAdapterPtr adapter;
    SessionServantManagerPtr servantManager;
    if(!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
    {
        adapter = _communicator->createObjectAdapter("IceGrid.Registry.AdminSessionManager");
        servantManager = new SessionServantManager(adapter, _instanceName, false, getServerAdminCategory(), router, 0);
        adapter->addServantLocator(servantManager, "");
    }

    assert(_reaper);
    _adminSessionFactory = new AdminSessionFactory(servantManager, _database, _reaper, this);

    if(servantManager)
    {
        Identity sessionMgrId;
        sessionMgrId.category = _instanceName;
        sessionMgrId.name = "AdminSessionManager";
        Identity sslSessionMgrId;
        sslSessionMgrId.category = _instanceName;
        sslSessionMgrId.name = "AdminSSLSessionManager";
        if(!_master)
        {
            sessionMgrId.name += "-" + _replicaName;
            sslSessionMgrId.name += "-" + _replicaName;
        }

        adapter->add(new AdminSessionManagerI(_adminSessionFactory), sessionMgrId);
        adapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslSessionMgrId);
        
        _wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId());
        _wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId());
    }

    if(adapter)
    {
        Ice::Identity dummy;
        dummy.name = "dummy";
        _wellKnownObjects->addEndpoint("AdminSessionManager", adapter->createDirectProxy(dummy));
    }

    _adminVerifier = getPermissionsVerifier(registryAdapter,
                                            locator,
                                            "IceGrid.Registry.AdminPermissionsVerifier",
                                            properties->getProperty("IceGrid.Registry.AdminCryptPasswords"));

    _sslAdminVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.AdminSSLPermissionsVerifier");

    return adapter;
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:56,代码来源:RegistryI.cpp

示例2: out

bool
RegistryI::setupUserAccountMapper(const Ice::ObjectAdapterPtr& registryAdapter)
{
    Ice::PropertiesPtr properties = _communicator->getProperties();

    //
    // Setup file user account mapper object if the property is set.
    //
    string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts");
    if(!userAccountFileProperty.empty())
    {
        try
        {
            Identity mapperId;
            mapperId.category = _instanceName;
            mapperId.name = "RegistryUserAccountMapper";
            if(!_master)
            {
                mapperId.name += "-" + _replicaName;
            }
            registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId);
            _wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId());
        }
        catch(const std::string& msg)
        {
            Error out(_communicator->getLogger());
            out << msg;
            return false;
        }
    }
    return true;
}
开发者ID:updowndown,项目名称:myffff,代码行数:32,代码来源:RegistryI.cpp

示例3: idToProxy

static ServerPrx idToProxy(int id, const Ice::ObjectAdapterPtr &adapter) {
	Ice::Identity ident;
	ident.category = "s";
	ident.name = u8(QString::number(id));

	return ServerPrx::uncheckedCast(adapter->createProxy(ident));
}
开发者ID:arrai,项目名称:mumble-record,代码行数:7,代码来源:MurmurIce.cpp

示例4: assert

void
RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter, 
                                    const Ice::ObjectAdapterPtr& sessionManagerAdapter,
                                    const IceGrid::LocatorPrx& locator,
                                    bool nowarn)
{
    assert(_reaper);
    _adminSessionFactory = new AdminSessionFactory(sessionManagerAdapter, _database, _reaper, this);

    if(sessionManagerAdapter)
    {
        Identity adminSessionMgrId;
        adminSessionMgrId.category = _instanceName;
        adminSessionMgrId.name = "AdminSessionManager";
        Identity sslAdmSessionMgrId;
        sslAdmSessionMgrId.category = _instanceName;
        sslAdmSessionMgrId.name = "AdminSSLSessionManager";
        if(!_master)
        {
            adminSessionMgrId.name += "-" + _replicaName;
            sslAdmSessionMgrId.name += "-" + _replicaName;
        }

        sessionManagerAdapter->add(new AdminSessionManagerI(_adminSessionFactory), adminSessionMgrId);
        sessionManagerAdapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslAdmSessionMgrId);
        
        _wellKnownObjects->add(sessionManagerAdapter->createProxy(adminSessionMgrId), 
                               Glacier2::SessionManager::ice_staticId());
        _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslAdmSessionMgrId), 
                               Glacier2::SSLSessionManager::ice_staticId());
    }

    Ice::PropertiesPtr properties = _communicator->getProperties();

    _adminVerifier = getPermissionsVerifier(registryAdapter,
                                            locator,
                                            "IceGrid.Registry.AdminPermissionsVerifier",
                                            properties->getProperty("IceGrid.Registry.AdminCryptPasswords"),
                                            nowarn);

    _sslAdminVerifier =
        getSSLPermissionsVerifier(locator, 
                                  "IceGrid.Registry.AdminSSLPermissionsVerifier", 
                                  nowarn);
}
开发者ID:updowndown,项目名称:myffff,代码行数:45,代码来源:RegistryI.cpp

示例5: appName

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

    NestedPrx nested = NestedPrx::checkedCast(communicator()->propertyToProxy("Nested.Proxy"));
    if(!nested)
    {
        cerr << appName() << ": invalid proxy" << endl;
        return EXIT_FAILURE;
    }
    
    //
    // Ensure the invocation times out if the nesting level is too
    // high and there are no more threads in the thread pool to
    // dispatch the call.
    //
    nested = nested->ice_invocationTimeout(5000);

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Nested.Client");
    NestedPrx self = NestedPrx::uncheckedCast(adapter->createProxy(communicator()->stringToIdentity("nestedClient")));
    NestedPtr servant = new NestedI(self);
    adapter->add(servant, communicator()->stringToIdentity("nestedClient"));
    adapter->activate();

    cout << "Note: The maximum nesting level is sz * 2, with sz being\n"
         << "the maximum number of threads in the server thread pool. if\n"
         << "you specify a value higher than that, the application will\n"
         << "block or timeout.\n"
         << endl;

    string s;
    do
    {
        try
        {
            cout << "enter nesting level or 'x' for exit: ";
            cin >> s;
            int level = atoi(s.c_str());
            if(level > 0)
            {
                nested->nestedCall(level, self);
            }
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
        }
    }
    while(cin.good() && s != "x");

    return EXIT_SUCCESS;
}
开发者ID:MemoRyAxis,项目名称:ice-demos,代码行数:57,代码来源:Client.cpp

示例6: initialize

        virtual void
        initialize(const Ice::ObjectAdapterPtr& adptr, const Ice::Identity& identity, const string& /*facet*/,
                   const Ice::ObjectPtr& servant)
        {
            CasinoStore::PersistentPlayerPrx prx =
                CasinoStore::PersistentPlayerPrx::uncheckedCast(adptr->createProxy(identity));

            PlayerI* player = dynamic_cast<PlayerI*>(servant.get());
            player->init(prx,  _server._playerEvictor, _server._bankPrx);
        }
开发者ID:fengpsky,项目名称:freeze,代码行数:10,代码来源:Server.cpp

示例7: WaitQueue

void
RegistryI::setupClientSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter,
                                     const Ice::ObjectAdapterPtr& sessionManagerAdapter,
                                     const IceGrid::LocatorPrx& locator,
                                     bool nowarn)
{
    _waitQueue = new WaitQueue(); // Used for for session allocation timeout.
    _waitQueue->start();
    
    assert(_reaper);
    _clientSessionFactory = new ClientSessionFactory(sessionManagerAdapter, _database, _waitQueue, _reaper);

    if(sessionManagerAdapter && _master) // Slaves don't support client session manager objects.
    {
        Identity clientSessionMgrId;
        clientSessionMgrId.category = _instanceName;
        clientSessionMgrId.name = "SessionManager";
        Identity sslClientSessionMgrId;
        sslClientSessionMgrId.category = _instanceName;
        sslClientSessionMgrId.name = "SSLSessionManager";

        sessionManagerAdapter->add(new ClientSessionManagerI(_clientSessionFactory), clientSessionMgrId);
        sessionManagerAdapter->add(new ClientSSLSessionManagerI(_clientSessionFactory), sslClientSessionMgrId);

        _wellKnownObjects->add(sessionManagerAdapter->createProxy(clientSessionMgrId), 
                               Glacier2::SessionManager::ice_staticId());
        
        _wellKnownObjects->add(sessionManagerAdapter->createProxy(sslClientSessionMgrId), 
                               Glacier2::SSLSessionManager::ice_staticId());
    }

    Ice::PropertiesPtr properties = _communicator->getProperties();

    _clientVerifier = getPermissionsVerifier(registryAdapter,
                                             locator,
                                             "IceGrid.Registry.PermissionsVerifier",
                                             properties->getProperty("IceGrid.Registry.CryptPasswords"), 
                                             nowarn);

    _sslClientVerifier = getSSLPermissionsVerifier(locator, 
                                                   "IceGrid.Registry.SSLPermissionsVerifier", 
                                                   nowarn);
}
开发者ID:updowndown,项目名称:myffff,代码行数:43,代码来源:RegistryI.cpp

示例8: while

vector<CasinoStore::PersistentBetPrx>
BankI::getBets(const Ice::ObjectAdapterPtr& adapter) const
{
    vector<CasinoStore::PersistentBetPrx> result;

    Freeze::EvictorIteratorPtr p = _betEvictor->getIterator("", 100);

    while(p->hasNext())
    {
        Ice::Identity ident = p->next();
        result.push_back(CasinoStore::PersistentBetPrx::uncheckedCast(adapter->createProxy(ident)));
    }

    return result;
}
开发者ID:ming-hai,项目名称:freeze,代码行数:15,代码来源:BankI.cpp

示例9: appName

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

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Nested.Server");
    NestedPrx self = NestedPrx::uncheckedCast(adapter->createProxy(communicator()->stringToIdentity("nestedServer")));
    NestedPtr servant = new NestedI(self);
    adapter->add(servant, communicator()->stringToIdentity("nestedServer"));
    adapter->activate();
    communicator()->waitForShutdown();
    return EXIT_SUCCESS;
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:17,代码来源:Server.cpp

示例10: getTestEndpoint

int
run(int, char**, const Ice::CommunicatorPtr& communicator,
    const Ice::InitializationData& initData)
{
    //
    // Register the server manager. The server manager creates a new
    // 'server' (a server isn't a different process, it's just a new
    // communicator and object adapter).
    //
    Ice::PropertiesPtr properties = communicator->getProperties();
    properties->setProperty("Ice.ThreadPool.Server.Size", "2");
    properties->setProperty("ServerManager.Endpoints", getTestEndpoint(communicator, 0) + ":udp");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ServerManager");

    //
    // We also register a sample server locator which implements the
    // locator interface, this locator is used by the clients and the
    // 'servers' created with the server manager interface.
    //
    ServerLocatorRegistryPtr registry = ICE_MAKE_SHARED(ServerLocatorRegistry);
    registry->addObject(adapter->createProxy(Ice::stringToIdentity("ServerManager")));
    Ice::ObjectPtr object = ICE_MAKE_SHARED(ServerManagerI, registry, initData);
    adapter->add(object, Ice::stringToIdentity("ServerManager"));

    Ice::LocatorRegistryPrxPtr registryPrx =
        ICE_UNCHECKED_CAST(Ice::LocatorRegistryPrx,
                           adapter->add(registry, Ice::stringToIdentity("registry")));

    Ice::LocatorPtr locator = ICE_MAKE_SHARED(ServerLocator, registry, registryPrx);
    adapter->add(locator, Ice::stringToIdentity("locator"));

    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
开发者ID:hadoop835,项目名称:ice,代码行数:38,代码来源:Server.cpp

示例11: ServerLocatorRegistry

int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator,
    const Ice::InitializationData& initData)
{
    //
    // Register the server manager. The server manager creates a new
    // 'server' (a server isn't a different process, it's just a new
    // communicator and object adapter).
    //
    Ice::PropertiesPtr properties = communicator->getProperties();
    properties->setProperty("Ice.ThreadPool.Server.Size", "2");
    properties->setProperty("ServerManager.Endpoints", "default -p 12010:udp");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ServerManager");

    //
    // We also register a sample server locator which implements the
    // locator interface, this locator is used by the clients and the
    // 'servers' created with the server manager interface.
    //
    ServerLocatorRegistryPtr registry = new ServerLocatorRegistry();
    registry->addObject(adapter->createProxy(communicator->stringToIdentity("ServerManager")));
    Ice::ObjectPtr object = new ServerManagerI(adapter, registry, initData);
    adapter->add(object, communicator->stringToIdentity("ServerManager"));

    Ice::LocatorRegistryPrx registryPrx = 
        Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator->stringToIdentity("registry")));

    Ice::LocatorPtr locator = new ServerLocator(registry, registryPrx);
    adapter->add(locator, communicator->stringToIdentity("locator"));

    adapter->activate();
    communicator->waitForShutdown();

    return EXIT_SUCCESS;
}
开发者ID:updowndown,项目名称:myffff,代码行数:36,代码来源:Server.cpp

示例12: e


//.........这里部分代码省略.........
                Ice::Identity id;
                id.category = instanceName;
                id.name = os.str();

                nodes[nodeid] = NodePrx::uncheckedCast((*p)->ice_adapterId(adapterid)->ice_identity(id));
            }
        }

        if(nodes.size() < 3)
        {
            Ice::Error error(communicator->getLogger());
            error << "Replication requires at least 3 Nodes";
            throw IceBox::FailureException(__FILE__, __LINE__, "Replication requires at least 3 Nodes");
        }

        try
        {
            // If the node thread pool size is not set then initialize
            // to the number of nodes + 1 and disable thread pool size
            // warnings.
            if(properties->getProperty(name + ".Node.ThreadPool.Size").empty())
            {
                ostringstream os;
                os << nodes.size() + 1;
                properties->setProperty(name + ".Node.ThreadPool.Size", os.str());
                properties->setProperty(name + ".Node.ThreadPool.SizeWarn", "0");
            }
            if(properties->getProperty(name + ".Node.MessageSizeMax").empty())
            {
                properties->setProperty(name + ".Node.MessageSizeMax", "0"); // No limit on data exchanged internally
            }

            Ice::ObjectAdapterPtr nodeAdapter = communicator->createObjectAdapter(name + ".Node");

            _instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter,
                                     nodeAdapter, nodes[id]);
            _instance->observers()->setMajority(static_cast<unsigned int>(nodes.size())/2);

            // Trace replication information.
            TraceLevelsPtr traceLevels = _instance->traceLevels();
            if(traceLevels->election > 0)
            {
                Ice::Trace out(traceLevels->logger, traceLevels->electionCat);
                out << "I am node " << id << "\n";
                for(map<int, NodePrx>::const_iterator p = nodes.begin(); p != nodes.end(); ++p)
                {
                    out << "\tnode: " << p->first << " proxy: " << p->second->ice_toString() << "\n";
                }
            }

            if(topicManagerAdapterId.empty())
            {
                // We're not using an IceGrid deployment. Here we need
                // a proxy which is used to create proxies to the
                // replicas later.
                _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->createProxy(topicManagerId));
            }
            else
            {
                // If we're using IceGrid deployment we need to create
                // indirect proxies.
                _managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->createIndirectProxy(topicManagerId));
            }

            _manager = new TopicManagerImpl(_instance);
            topicAdapter->add(_manager->getServant(), topicManagerId);

            ostringstream os; // The node object identity.
            os << "node" << id;
            Ice::Identity nodeid;
            nodeid.category = instanceName;
            nodeid.name = os.str();

            NodeIPtr node = new NodeI(_instance, _manager, _managerProxy, id, nodes);
            _instance->setNode(node);
            nodeAdapter->add(node, nodeid);
            nodeAdapter->activate();

            node->start();
        }
        catch(const Ice::Exception& ex)
        {
            _instance = 0;

            LoggerOutputBase s;
            s << "exception while starting IceStorm service " << name << ":\n";
            s << ex;

            IceBox::FailureException e(__FILE__, __LINE__);
            e.reason = s.str();
            throw e;
        }
    }

    topicAdapter->add(new FinderI(TopicManagerPrx::uncheckedCast(topicAdapter->createProxy(topicManagerId))),
                      communicator->stringToIdentity("IceStorm/Finder"));

    topicAdapter->activate();
    publishAdapter->activate();
}
开发者ID:herclogon,项目名称:ice,代码行数:101,代码来源:Service.cpp

示例13: if

int
CallbackClient::run(int argc, char* argv[])
{
    //
    // Since this is an interactive demo we want the custom interrupt
    // callback to be called when the process is interrupted.
    //
    callbackOnInterrupt();

    CallbackSenderPrx twoway = CallbackSenderPrx::checkedCast(
        communicator()->propertyToProxy("Callback.CallbackServer")->
            ice_twoway()->ice_timeout(-1)->ice_secure(false));
    if(!twoway)
    {
        cerr << appName() << ": invalid proxy" << endl;
        return EXIT_FAILURE;
    }
    CallbackSenderPrx oneway = CallbackSenderPrx::uncheckedCast(twoway->ice_oneway());
    CallbackSenderPrx batchOneway = CallbackSenderPrx::uncheckedCast(twoway->ice_batchOneway());
    CallbackSenderPrx datagram = CallbackSenderPrx::uncheckedCast(twoway->ice_datagram());
    CallbackSenderPrx batchDatagram = CallbackSenderPrx::uncheckedCast(twoway->ice_batchDatagram());
    
    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client");
    adapter->add(new CallbackReceiverI, communicator()->stringToIdentity("callbackReceiver"));
    adapter->activate();

    CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast(
        adapter->createProxy(communicator()->stringToIdentity("callbackReceiver")));
    CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
    CallbackReceiverPrx datagramR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_datagram());

    bool secure = false;
    string secureStr = "";

    menu();

    char c;
    do
    {
        try
        {
            cout << "==> ";
            cin >> c;
            if(c == 't')
            {
                twoway->initiateCallback(twowayR);
            }
            else if(c == 'o')
            {
                oneway->initiateCallback(onewayR);
            }
            else if(c == 'O')
            {
                batchOneway->initiateCallback(onewayR);
            }
            else if(c == 'd')
            {
                if(secure)
                {
                    cout << "secure datagrams are not supported" << endl;
                }
                else
                {
                    datagram->initiateCallback(datagramR);
                }
            }
            else if(c == 'D')
            {
                if(secure)
                {
                    cout << "secure datagrams are not supported" << endl;
                }
                else
                {
                    batchDatagram->initiateCallback(datagramR);
                }
            }
            else if(c == 'f')
            {
                communicator()->flushBatchRequests();
            }
            else if(c == 'S')
            {
                secure = !secure;
                secureStr = secure ? "s" : "";
                
                twoway = CallbackSenderPrx::uncheckedCast(twoway->ice_secure(secure));
                oneway = CallbackSenderPrx::uncheckedCast(oneway->ice_secure(secure));
                batchOneway = CallbackSenderPrx::uncheckedCast(batchOneway->ice_secure(secure));
                datagram = CallbackSenderPrx::uncheckedCast(datagram->ice_secure(secure));
                batchDatagram = CallbackSenderPrx::uncheckedCast(batchDatagram->ice_secure(secure));

                twowayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_secure(secure));
                onewayR = CallbackReceiverPrx::uncheckedCast(onewayR->ice_secure(secure));
                datagramR = CallbackReceiverPrx::uncheckedCast(datagramR->ice_secure(secure));
                
                if(secure)
                {
                    cout << "secure mode is now on" << endl;
                }
//.........这里部分代码省略.........
开发者ID:updowndown,项目名称:myffff,代码行数:101,代码来源:Client.cpp

示例14: if

int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    if(argc > 1)
    {
        fprintf(stderr, "%s: too many arguments\n", argv[0]);
        return EXIT_FAILURE;
    }

    Ice::PropertiesPtr properties = communicator->getProperties();
    const char* proxyProperty = "CallbackSender.Proxy";
    string proxy = properties->getProperty(proxyProperty);
    if(proxy.empty())
    {
        fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
        return EXIT_FAILURE;
    }

    Ice::ObjectPrx base = communicator->stringToProxy(proxy);
    CallbackSenderPrx twoway = CallbackSenderPrx::checkedCast(base->ice_twoway()->ice_timeout(-1));
    if(!twoway)
    {
        fprintf(stderr, "%s: invalid proxy\n", argv[0]);
        return EXIT_FAILURE;
    }
    CallbackSenderPrx oneway = twoway->ice_oneway();
#ifdef ICEE_HAS_BATCH
    CallbackSenderPrx batchOneway = twoway->ice_batchOneway();
#endif    
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Callback.Client");
    CallbackReceiverPtr cr = new CallbackReceiverI;
    adapter->add(cr, communicator->stringToIdentity("callbackReceiver"));
    adapter->activate();

    CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast(
        adapter->createProxy(communicator->stringToIdentity("callbackReceiver")));
    CallbackReceiverPrx onewayR = twowayR->ice_oneway();

    menu();

    char c = EOF;
    do
    {
        try
        {
            printf("==> "); fflush(stdout);
            do
            {
               c = getchar();
            }
            while(c != EOF && c == '\n');
            if(c == 't')
            {
                twoway->initiateCallback(twowayR);
            }
            else if(c == 'o')
            {
                oneway->initiateCallback(onewayR);
            }
#ifdef ICEE_HAS_BATCH
            else if(c == 'O')
            {
                batchOneway->initiateCallback(onewayR);
            }
            else if(c == 'f')
            {
                batchOneway->ice_flushBatchRequests();
            }
#endif
            else if(c == 's')
            {
                twoway->shutdown();
            }
            else if(c == 'x')
            {
                // Nothing to do
            }
            else if(c == '?')
            {
                menu();
            }
            else
            {
                printf("unknown command `%c'\n", c);
                menu();
            }
        }
        catch(const Ice::Exception& ex)
        {
            fprintf(stderr, "%s\n", ex.toString().c_str());
        }
    }
    while(c != EOF && c != 'x');

    return EXIT_SUCCESS;
}
开发者ID:glockwork,项目名称:dfu,代码行数:96,代码来源:Client.cpp

示例15: if

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

    CallbackSenderPrx sender = CallbackSenderPrx::checkedCast(
        communicator()->propertyToProxy("CallbackSender.Proxy")->ice_twoway()->ice_timeout(-1)->ice_secure(false));
    if(!sender)
    {
        cerr << appName() << ": invalid proxy" << endl;
        return EXIT_FAILURE;
    }

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Client");
    CallbackReceiverPtr cr = new CallbackReceiverI;
    adapter->add(cr, communicator()->stringToIdentity("callbackReceiver"));
    adapter->activate();

    CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(
        adapter->createProxy(communicator()->stringToIdentity("callbackReceiver")));

    menu();

    char c = 'x';
    do
    {
        try
        {
            cout << "==> ";
            cin >> c;
            if(c == 't')
            {
                sender->initiateCallback(receiver);
            }
            else if(c == 's')
            {
                sender->shutdown();
            }
            else if(c == 'x')
            {
                // Nothing to do
            }
            else if(c == '?')
            {
                menu();
            }
            else
            {
                cout << "unknown command `" << c << "'" << endl;
                menu();
            }
        }
        catch(const Ice::Exception& ex)
        {
            cerr << ex << endl;
        }
    }
    while(cin.good() && c != 'x');

    return EXIT_SUCCESS;
}
开发者ID:MemoRyAxis,项目名称:ice-demos,代码行数:65,代码来源:Client.cpp


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