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


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

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


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

示例1: 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(ICE_MAKE_SHARED(TestIntfI,communicator), Ice::stringToIdentity("TEST"));
    adapter->add(ICE_MAKE_SHARED(Test1::WstringClassI), Ice::stringToIdentity("WSTRING1"));
    adapter->add(ICE_MAKE_SHARED(Test2::WstringClassI), Ice::stringToIdentity("WSTRING2"));

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

    return EXIT_SUCCESS;
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:15,代码来源:ServerAMD.cpp

示例2: NullPermissionsVerifierI

void
RegistryI::setupNullPermissionsVerifier(const Ice::ObjectAdapterPtr& registryAdapter)
{
    Identity nullPermVerifId;
    nullPermVerifId.category = _instanceName;
    nullPermVerifId.name = "NullPermissionsVerifier";
    _nullPermissionsVerifier = Glacier2::PermissionsVerifierPrx::uncheckedCast(
        registryAdapter->add(new NullPermissionsVerifierI(), nullPermVerifId)->ice_collocationOptimized(true));

    Identity nullSSLPermVerifId;
    nullSSLPermVerifId.category = _instanceName;
    nullSSLPermVerifId.name = "NullSSLPermissionsVerifier";
    _nullSSLPermissionsVerifier = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(
        registryAdapter->add(new NullSSLPermissionsVerifierI(), nullSSLPermVerifId)->ice_collocationOptimized(true));
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:15,代码来源:RegistryI.cpp

示例3: initialize

void
Server::run(int argc, char** argv)
{
#ifdef ICE_STATIC_LIBS
    Ice::registerIceDiscovery();
#endif

    Ice::CommunicatorHolder communicator = initialize(argc, argv);
    Ice::PropertiesPtr properties = communicator->getProperties();

    int num = argc == 2 ? atoi(argv[1]) : 0;

    properties->setProperty("ControlAdapter.Endpoints", getTestEndpoint(num));

    {
        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), Ice::stringToIdentity(os.str()));
    }
    adapter->activate();

    serverReady();

    communicator->waitForShutdown();
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:32,代码来源:Server.cpp

示例4: 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;
}
开发者ID:marcinlos,项目名称:rozprochy,代码行数:33,代码来源:server.cpp

示例5: run

    virtual int
    run(int argc, char* argv[])
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties();
        initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");

        loadConfig(initData.properties);
        initData.logger = getLogger();
        setCommunicator(Ice::initialize(argc, argv, initData));

        Ice::ObjectFactoryPtr factory = new MyObjectFactory;
        communicator()->addObjectFactory(factory, "::Test::I");
        communicator()->addObjectFactory(factory, "::Test::J");
        communicator()->addObjectFactory(factory, "::Test::H");

        Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
        InitialPtr initial = new InitialI(adapter);
        adapter->add(initial, communicator()->stringToIdentity("initial"));
        adapter->activate();

#ifndef _WIN32_WCE
        communicator()->waitForShutdown();
#endif

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

示例6: 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;
}
开发者ID:ChrisCarlsen,项目名称:tortuga,代码行数:35,代码来源:lcdshow.cpp

示例7: TestI

void
ServiceI::start(const string& name, const CommunicatorPtr& communicator, const StringSeq& args)
{
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(name + "OA");
    adapter->add(new TestI(args), communicator->stringToIdentity("test"));
    adapter->activate();
}
开发者ID:pedia,项目名称:zeroc-ice,代码行数:7,代码来源:Service.cpp

示例8: initIceConnection

DetectorPrx initIceConnection(const std::string& detectorNameStr,
                              Ice::Identity& det_cb,
                              DetectorCallbackHandlerPtr cr)
{
  
  initIce(detectorNameStr);
  
  Ice::PropertiesPtr props = iceComm->getProperties();
  std::string proxStr = detectorNameStr + ".Proxy";
  DetectorPrx detector = NULL;
  try
  {
  
    detector = DetectorPrx::checkedCast(
        iceComm->propertyToProxy(proxStr)->ice_twoway());
  }
  catch (const IceUtil::NullHandleException& e)
  {
    localAndClientMsg( VLogger::ERROR, NULL, "Invalid proxy: '%s'. %s\n", 
                       detectorNameStr.c_str(), e.what());
    return NULL;
  }

  Ice::ObjectAdapterPtr adapter = iceComm->createObjectAdapter("");
  det_cb.name = IceUtil::generateUUID();
  det_cb.category = "";
  adapter->add(cr, det_cb);
  adapter->activate();
  detector->ice_getConnection()->setAdapter(adapter);    
  
  // note that we need an ObjectAdapter to permit bidirectional communication
  // if we want to get past firewalls without Glacier2
  
  return detector;  // Success
}
开发者ID:AlgorithemJourney,项目名称:CVAC,代码行数:35,代码来源:ServiceInvocation.cpp

示例9: 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;
}
开发者ID:mvxi,项目名称:icetest,代码行数:31,代码来源:Server.cpp

示例10: appName

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

    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Callback.Server");
    CallbackSenderIPtr sender = new CallbackSenderI(communicator());
    adapter->add(sender, communicator()->stringToIdentity("sender"));
    adapter->activate();

    sender->start();
    try
    {
        communicator()->waitForShutdown();
    }
    catch(...)
    {
        sender->destroy();
        throw;
    }
    sender->destroy();

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

示例11: run

        /**
         * Главная процедура
         **/
        virtual int run(int, char* [])
        {
            // Получаем адаптер
            Ice::ObjectAdapterPtr adapter = 
                communicator()->createObjectAdapterWithEndpoints("MaximaWorkerAdapter", "default -p 31337");

            //И регистриуем наш объект
            Ice::ObjectPtr object = new MaximaWorkerImpl();
            Ice::ObjectPrx objPrx = adapter->add(object, communicator()->stringToIdentity("MaximaWorker"));
            adapter->activate();

            //Получаем объект диспетчера
            //TODO: приделать сюда указание хоста.
            Ice::ObjectPrx obj = 
                communicator()->stringToProxy("MaximaDispatcher:default -p 31338");
            MaximaLib::MaximaDispatcherPrx disp = MaximaLib::MaximaDispatcherPrx::checkedCast(obj);

            if(!disp)
                throw "Wrong disp";

            // Регистриуемся в диспетчере
            MaximaLib::MaximaWorkerPrx wrkPrx = MaximaLib::MaximaWorkerPrx::uncheckedCast(objPrx);
            disp->registerWorker(wrkPrx);
 
            // Продожаем работать, пока нас не прервут.
            communicator()->waitForShutdown();
        }
开发者ID:bezgins,项目名称:maxima_comm,代码行数:30,代码来源:main.cpp

示例12: 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

示例13: 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;
}
开发者ID:465060874,项目名称:ice,代码行数:31,代码来源:Server.cpp

示例14: setProcessStringConverter

void
Server::run(int argc, char** argv)
{
    setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
    setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
    Ice::CommunicatorHolder communicator = initialize(argc, argv);
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("TEST"));
    adapter->add(ICE_MAKE_SHARED(Test1::WstringClassI), Ice::stringToIdentity("WSTRING1"));
    adapter->add(ICE_MAKE_SHARED(Test2::WstringClassI), Ice::stringToIdentity("WSTRING2"));

    adapter->activate();
    serverReady();
    communicator->waitForShutdown();
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:16,代码来源:Server.cpp

示例15: createTestProperties

void
Server::run(int argc, char** argv)
{
    Ice::PropertiesPtr properties = createTestProperties(argc, argv);

#if TARGET_OS_IPHONE != 0
    //
    // COMPILERFIX: Disable connect timeout introduced for
    // workaround to iOS device hangs when using SSL
    //
    properties->setProperty("Ice.Override.ConnectTimeout", "");
#endif

    //
    // This test kills connections, so we don't want warnings.
    //
    properties->setProperty("Ice.Warn.Connections", "0");

    //
    // The client sends large messages to cause the transport
    // buffers to fill up.
    //
    properties->setProperty("Ice.MessageSizeMax", "20000");

    //
    // Limit the recv buffer size, this test relies on the socket
    // send() blocking after sending a given amount of data.
    //
    properties->setProperty("Ice.TCP.RcvSize", "50000");

    Ice::CommunicatorHolder communicator = initialize(argc, argv, properties);

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint());
    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(1));
    communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(TimeoutI), Ice::stringToIdentity("timeout"));
    adapter->activate();

    Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
    controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
    controllerAdapter->activate();

    serverReady();
    communicator->waitForShutdown();
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:47,代码来源:Server.cpp


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