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


C++ CommunicatorPtr::getPluginManager方法代码示例

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


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

示例1: getTestEndpoint

int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1, "tcp"));
    communicator->getProperties()->setProperty("ControllerAdapter.ThreadPool.Size", "1");

    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("ControllerAdapter");

#ifdef ICE_CPP11_MAPPING
    shared_ptr<PluginI> plugin = dynamic_pointer_cast<PluginI>(communicator->getPluginManager()->getPlugin("Test"));
#else
    PluginI* plugin = dynamic_cast<PluginI*>(communicator->getPluginManager()->getPlugin("Test").get());
#endif
    assert(plugin);
    ConfigurationPtr configuration = plugin->getConfiguration();
    BackgroundControllerIPtr backgroundController = ICE_MAKE_SHARED(BackgroundControllerI, adapter, configuration);

    adapter->add(ICE_MAKE_SHARED(BackgroundI, backgroundController), communicator->stringToIdentity("background"));
    adapter->add(ICE_MAKE_SHARED(LocatorI, backgroundController), communicator->stringToIdentity("locator"));
    adapter->add(ICE_MAKE_SHARED(RouterI, backgroundController), communicator->stringToIdentity("router"));
    adapter->activate();

    adapter2->add(backgroundController, communicator->stringToIdentity("backgroundController"));
    adapter2->activate();

    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
开发者ID:The-Mad-Pirate,项目名称:ice,代码行数:30,代码来源:Server.cpp

示例2: catch


//.........这里部分代码省略.........
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing a simple plug-in that fails to initialize... " << flush;
    communicator = 0;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.Test", "plugins/TestPlugin:createPluginInitializeFail");
        communicator = Ice::initialize(argc, argv, initData);
        test(false);
    }
    catch(const std::exception& ex)
    {
        test(string(ex.what()) == "PluginInitializeFailExeption");
    }
    test(!communicator);
    cout << "ok" << endl;

    cout << "testing plug-in load order... " << flush;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
        initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
        initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
        initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
        communicator = Ice::initialize(argc, argv, initData);
        communicator->destroy();
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing plug-in manager... " << flush;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
        initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
        initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
        initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
        initData.properties->setProperty("Ice.InitPlugins", "0");
        communicator = Ice::initialize(argc, argv, initData);

        Ice::PluginManagerPtr pm = communicator->getPluginManager();
        test(pm->getPlugin("PluginOne"));
        test(pm->getPlugin("PluginTwo"));
        test(pm->getPlugin("PluginThree"));

        MyPluginPtr p4 = new MyPlugin;
        pm->addPlugin("PluginFour", p4);
        test(pm->getPlugin("PluginFour"));

        pm->initializePlugins();

        test(p4->isInitialized());

        communicator->destroy();

        test(p4->isDestroyed());
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing destroy when a plug-in fails to initialize... " << flush;
    communicator = 0;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.PluginOneFail", "plugins/TestPlugin:createPluginOneFail");
        initData.properties->setProperty("Ice.Plugin.PluginTwoFail", "plugins/TestPlugin:createPluginTwoFail");
        initData.properties->setProperty("Ice.Plugin.PluginThreeFail", "plugins/TestPlugin:createPluginThreeFail");
        initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOneFail, PluginTwoFail, PluginThreeFail");
        communicator = Ice::initialize(argc, argv, initData);
        test(false);
    }
    catch(const std::exception& ex)
    {
        test(string(ex.what()) == "PluginInitializeFailExeption");
    }
    test(!communicator);
    cout << "ok" << endl;

    return status;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:101,代码来源:Client.cpp

示例3: catch

int
main(int argc, char* argv[])
{
    int status = EXIT_SUCCESS;
    Ice::CommunicatorPtr communicator;

    cout << "testing a simple plug-in... " << flush;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.Test",
            "plugins/TestPlugin:createPlugin 'C:\\Program Files\\' --DatabasePath "
            "'C:\\Program Files\\Application\\db'" );
        communicator = Ice::initialize(argc, argv, initData);
        communicator->destroy();
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing a simple plug-in that fails to initialize... " << flush;
    communicator = 0;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.Test", "plugins/TestPlugin:createPluginInitializeFail");
        communicator = Ice::initialize(argc, argv, initData);
        test(false);
    }
    catch(const std::exception& ex)
    {
        test(string(ex.what()) == "PluginInitializeFailExeption");
    }
    test(!communicator);
    cout << "ok" << endl;

    cout << "testing plug-in load order... " << flush;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
        initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
        initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
        initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo"); // Exclude PluginThree
        communicator = Ice::initialize(argc, argv, initData);
        communicator->destroy();
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing plug-in manager... " << flush;
    try
    {
        Ice::InitializationData initData;
        initData.properties = Ice::createProperties(argc, argv);
        initData.properties->setProperty("Ice.Plugin.PluginOne", "plugins/TestPlugin:createPluginOne");
        initData.properties->setProperty("Ice.Plugin.PluginTwo", "plugins/TestPlugin:createPluginTwo");
        initData.properties->setProperty("Ice.Plugin.PluginThree", "plugins/TestPlugin:createPluginThree");
        initData.properties->setProperty("Ice.PluginLoadOrder", "PluginOne, PluginTwo");
        initData.properties->setProperty("Ice.InitPlugins", "0");
        communicator = Ice::initialize(argc, argv, initData);

        Ice::PluginManagerPtr pm = communicator->getPluginManager();
        test(pm->getPlugin("PluginOne"));
        test(pm->getPlugin("PluginTwo"));
        test(pm->getPlugin("PluginThree"));

        MyPluginPtr p4 = new MyPlugin;
        pm->addPlugin("PluginFour", p4);
        test(pm->getPlugin("PluginFour"));

        pm->initializePlugins();

        test(p4->isInitialized());

        communicator->destroy();

        test(p4->isDestroyed());
    }
    catch(const Ice::Exception& ex)
    {
        cerr << ex << endl;
        test(false);
    }
    cout << "ok" << endl;

    cout << "testing destroy when a plug-in fails to initialize... " << flush;
    communicator = 0;
    try
    {
//.........这里部分代码省略.........
开发者ID:sbesson,项目名称:zeroc-ice,代码行数:101,代码来源:Client.cpp


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