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


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

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


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

示例1: ICE_UNCHECKED_CAST

RemoteObjectAdapterPrx
RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpts, const Current& current)
#endif
{
    Ice::CommunicatorPtr com = current.adapter->getCommunicator();
    const string defaultProtocol = com->getProperties()->getProperty("Ice.Default.Protocol");
    int retry = 5;
    while(true)
    {
        try
        {
            string endpoints = endpts;
            if(defaultProtocol != "bt")
            {
                if(endpoints.find("-p") == string::npos)
                {
                    endpoints = getTestEndpoint(com, _nextPort++, endpoints);
                }
            }
            com->getProperties()->setProperty(name + ".ThreadPool.Size", "1");
            ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints);
            return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx,
                                      current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter)));
        }
        catch(const Ice::SocketException&)
        {
            if(--retry == 0)
            {
                throw;
            }
        }
    }
}
开发者ID:zmyer,项目名称:ice,代码行数:33,代码来源:TestI.cpp

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

示例3: FeatureNotSupportedException

IceObjC::Instance::Instance(const Ice::CommunicatorPtr& com, Short type, const string& protocol, bool secure) :
    ProtocolInstance(com, type, protocol, secure),
    _voip(com->getProperties()->getPropertyAsIntWithDefault("Ice.Voip", 0) > 0),
    _communicator(com),
    _proxySettings(0)
{
    const Ice::PropertiesPtr properties = com->getProperties();

    //
    // Proxy settings
    //
    _proxyHost = properties->getProperty("Ice.SOCKSProxyHost");
    if(!_proxyHost.empty())
    {
#if TARGET_IPHONE_SIMULATOR != 0
        throw Ice::FeatureNotSupportedException(__FILE__, __LINE__, "SOCKS proxy not supported");
#endif
        _proxySettings.reset(CFDictionaryCreateMutable(0, 3, &kCFTypeDictionaryKeyCallBacks,
                                                       &kCFTypeDictionaryValueCallBacks));

        _proxyPort = properties->getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);

        UniqueRef<CFStringRef> host(toCFString(_proxyHost));
        CFDictionarySetValue(_proxySettings.get(), kCFStreamPropertySOCKSProxyHost, host.get());

        UniqueRef<CFNumberRef> port(CFNumberCreate(0, kCFNumberSInt32Type, &_proxyPort));
        CFDictionarySetValue(_proxySettings.get(), kCFStreamPropertySOCKSProxyPort, port.get());

        CFDictionarySetValue(_proxySettings.get(), kCFStreamPropertySOCKSVersion, kCFStreamSocketSOCKSVersion4);
    }
}
开发者ID:ming-hai,项目名称:ice,代码行数:31,代码来源:StreamEndpointI.cpp

示例4: txn

PersistentInstance::PersistentInstance(
    const string& instanceName,
    const string& name,
    const Ice::CommunicatorPtr& communicator,
    const Ice::ObjectAdapterPtr& publishAdapter,
    const Ice::ObjectAdapterPtr& topicAdapter,
    const Ice::ObjectAdapterPtr& nodeAdapter,
    const NodePrx& nodeProxy) :
    Instance(instanceName, name, communicator, publishAdapter, topicAdapter, nodeAdapter, nodeProxy),
    _dbLock(communicator->getProperties()->getPropertyWithDefault(name + ".LMDB.Path", name) + "/icedb.lock"),
    _dbEnv(communicator->getProperties()->getPropertyWithDefault(name + ".LMDB.Path", name), 2,
           IceDB::getMapSize(communicator->getProperties()->getPropertyAsInt(name + ".LMDB.MapSize")))
{
    try
    {
        dbContext.communicator = communicator;
        dbContext.encoding.minor = 1;
        dbContext.encoding.major = 1;

        IceDB::ReadWriteTxn txn(_dbEnv);

        _lluMap = LLUMap(txn, "llu", dbContext, MDB_CREATE);
        _subscriberMap = SubscriberMap(txn, "subscribers", dbContext, MDB_CREATE, compareSubscriberRecordKey);

        txn.commit();
    }
    catch(...)
    {
        shutdown();
        destroy();

        throw;
    }
}
开发者ID:zhangwei5095,项目名称:ice,代码行数:34,代码来源:Instance.cpp

示例5: getTestEndpoint

int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    IceUtil::TimerPtr timer = new IceUtil::Timer();

    communicator->getProperties()->setProperty("TestAdapter1.Endpoints", getTestEndpoint(communicator, 0) + ":udp");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Size", "5");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeMax", "5");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.SizeWarn", "0");
    communicator->getProperties()->setProperty("TestAdapter1.ThreadPool.Serialize", "0");
    Ice::ObjectAdapterPtr adapter1 = communicator->createObjectAdapter("TestAdapter1");
    adapter1->add(ICE_MAKE_SHARED(HoldI, timer, adapter1), communicator->stringToIdentity("hold"));

    communicator->getProperties()->setProperty("TestAdapter2.Endpoints", getTestEndpoint(communicator, 1) + ":udp");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Size", "5");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeMax", "5");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.SizeWarn", "0");
    communicator->getProperties()->setProperty("TestAdapter2.ThreadPool.Serialize", "1");
    Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter2");
    adapter2->add(ICE_MAKE_SHARED(HoldI, timer, adapter2), communicator->stringToIdentity("hold"));

    adapter1->activate();
    adapter2->activate();

    TEST_READY

    communicator->waitForShutdown();

    timer->destroy();

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

示例6: ICE_UNCHECKED_CAST

RemoteObjectAdapterPrx
RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpts, const Current& current)
#endif
{
    Ice::CommunicatorPtr com = current.adapter->getCommunicator();
    const string defaultProtocol = com->getProperties()->getProperty("Ice.Default.Protocol");

    string endpoints = endpts;
    if(defaultProtocol != "bt")
    {
        if(endpoints.find("-p") == string::npos)
        {
            // Use a fixed port if none is specified (bug 2896)
            ostringstream os;
            os << endpoints << " -h \""
               << (com->getProperties()->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"))
               << "\" -p " << _nextPort++;
            endpoints = os.str();
        }
    }
    
    com->getProperties()->setProperty(name + ".ThreadPool.Size", "1");
    ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints);
    return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx, current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter)));
}
开发者ID:hadoop835,项目名称:ice,代码行数:25,代码来源:TestI.cpp

示例7: if

RemoteConfig::RemoteConfig(const std::string& name, int argc, char** argv, const Ice::CommunicatorPtr& communicator) :
    _status(1)
{
    //
    // If ControllerHost is defined, we are using a server on a remote host. We expect a
    // test controller will already be active. We let exceptions propagate out to
    // the caller.
    //
    // Also look for a ConfigName property, which specifies the name of the configuration
    // we are currently testing.
    //
    std::string controllerHost;
    std::string configName;
    for(int i = 1; i < argc; ++i)
    {
        std::string opt = argv[i];
        if(opt.find("--ControllerHost") == 0)
        {
            std::string::size_type pos = opt.find('=');
            if(pos != std::string::npos && opt.size() > pos + 1)
            {
                controllerHost = opt.substr(pos + 1);
            }
        }
        else if(opt.find("--ConfigName") == 0)
        {
            std::string::size_type pos = opt.find('=');
            if(pos != std::string::npos && opt.size() > pos + 1)
            {
                configName = opt.substr(pos + 1);
            }
        }
    }

    Test::Common::ServerPrxPtr server;

    if(!controllerHost.empty())
    {
        std::string prot = communicator->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "tcp");
        std::string host;
        if(prot != "bt")
        {
            host = communicator->getProperties()->getProperty("Ice.Default.Host");
        }

        Test::Common::StringSeq options;

        Test::Common::ControllerPrxPtr controller = ICE_CHECKED_CAST(Test::Common::ControllerPrx,
            communicator->stringToProxy("controller:tcp -h " + controllerHost + " -p 15000"));
        server = controller->runServer("cpp", name, prot, host, false, configName, options);
        server->waitForServer();
    }

    _server = server;
}
开发者ID:SmarkSeven,项目名称:ice,代码行数:55,代码来源:TestCommon.cpp

示例8: getTestEndpoint

int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();
    properties->setProperty("Ice.Warn.Dispatch", "0");
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + " -t 2000");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("Test"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
开发者ID:ming-hai,项目名称:ice,代码行数:13,代码来源:ServerAMD.cpp

示例9: ThrowerI

int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
    Ice::PropertiesPtr properties = communicator->getProperties();
    properties->setProperty("Ice.Warn.Dispatch", "0");
    communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    Ice::ObjectPtr object = new ThrowerI();
    adapter->add(object, communicator->stringToIdentity("thrower"));
    adapter->activate();
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:13,代码来源:Server.cpp

示例10:

void
ServerManagerI::startServer(const Ice::Current&)
{
    for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
    {
        (*i)->waitForShutdown();
        (*i)->destroy();
    }
    _communicators.clear();

    //
    // Simulate a server: create a new communicator and object
    // adapter. The object adapter is started on a system allocated
    // port. The configuration used here contains the Ice.Locator
    // configuration variable. The new object adapter will register
    // its endpoints with the locator and create references containing
    // the adapter id instead of the endpoints.
    //
    Ice::CommunicatorPtr serverCommunicator = Ice::initialize(_initData);
    _communicators.push_back(serverCommunicator);

    //
    // Use fixed port to ensure that OA re-activation doesn't re-use previous port from
    // another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
    //
    {
        std::ostringstream os;
        os << "default -p " << _nextPort++;
        serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", os.str());
    }
    {
        std::ostringstream os;
        os << "default -p " << _nextPort++;
        serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", os.str());
    }

    Ice::ObjectAdapterPtr adapter = serverCommunicator->createObjectAdapter("TestAdapter");
    Ice::ObjectAdapterPtr adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2");

    Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:default -p 12010");
    adapter->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
    adapter2->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));

    Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI, adapter, adapter2, _registry);
    _registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test")));
    _registry->addObject(adapter->add(object, serverCommunicator->stringToIdentity("test2")));
    adapter->add(object, serverCommunicator->stringToIdentity("test3"));

    adapter->activate();
    adapter2->activate();
}
开发者ID:chenbk85,项目名称:ice,代码行数:51,代码来源:TestI.cpp

示例11: test

void
allTests(Test::TestHelper* helper)
{
    Ice::CommunicatorPtr communicator = helper->communicator();
    string sref = "test:" + helper->getTestEndpoint();
    Ice::ObjectPrxPtr obj = communicator->stringToProxy(sref);
    test(obj);

    int proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.HTTPProxyPort");
    if(proxyPort == 0)
    {
        proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.SOCKSProxyPort");
    }

    TestIntfPrxPtr test = ICE_CHECKED_CAST(TestIntfPrx, obj);
    test(test);

    cout << "testing connection... " << flush;
    {
        test->ice_ping();
    }
    cout << "ok" << endl;

    cout << "testing connection information... " << flush;
    {
        Ice::IPConnectionInfoPtr info = getIPConnectionInfo(test->ice_getConnection()->getInfo());
        test(info->remotePort == proxyPort); // make sure we are connected to the proxy port.
    }
    cout << "ok" << endl;

    cout << "shutting down server... " << flush;
    {
        test->shutdown();
    }
    cout << "ok" << endl;

    cout << "testing connection failure... " << flush;
    {
        try
        {
            test->ice_ping();
            test(false);
        }
        catch(const Ice::LocalException&)
        {
        }
    }
    cout << "ok" << endl;
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:49,代码来源:AllTests.cpp

示例12: initialize

void MyUtil::initialize() {
  ServiceI& service = ServiceI::instance();
  service.getAdapter()->add(&FeedFocusInvertI::instance(), service.createIdentity(
      "M", ""));
  Ice::CommunicatorPtr communicator = service.getCommunicator();

  int mod = communicator->getProperties()->getPropertyAsInt( "FeedFocusInvert.Mod");
  int interval = communicator->getProperties()->getPropertyAsIntWithDefault( "FeedFocusInvert.Interval", 5);
  xce::serverstate::ServerStateSubscriber::instance().initialize( "ControllerFeedFocusInvertR", &FeedFocusInvertI::instance(), mod, interval,
      new XceFeedChannel());
  MCE_INFO("MyUtil::initialize. mod:" << mod << " interval:" << interval);


  TaskManager::instance().scheduleRepeated(&FeedFocusInvertStatTimer::instance());
}
开发者ID:bradenwu,项目名称:oce,代码行数:15,代码来源:FeedFocusInvertI.cpp

示例13:

pointcloudClient::pointcloudClient(Ice::CommunicatorPtr ic, std::string prefix, std::string proxy)
{
	this->newData=false;

	this->prefix=prefix;
	Ice::PropertiesPtr prop;
	prop = ic->getProperties();
	this->refreshRate=0;

	int fps=prop->getPropertyAsIntWithDefault(prefix+"Fps",10);
	this->cycle=(float)(1/(float)fps)*1000000;
	try{
		Ice::ObjectPrx basePointCloud = ic->stringToProxy(proxy);
		if (0==basePointCloud){
			throw prefix + " Could not create proxy";
		}
		else {
			this->prx = jderobot::pointCloudPrx::checkedCast(basePointCloud);
			if (0==this->prx)
				throw "Invalid proxy" + prefix;

		}
	}catch (const Ice::Exception& ex) {
		std::cerr << ex << std::endl;
		throw "Invalid proxy" + prefix;
	}
	catch (const char* msg) {
		std::cerr << msg << std::endl;
		jderobot::Logger::getInstance()->error(prefix + " Not camera provided");
		throw "Invalid proxy" + prefix;
	}
	_done=false;
	this->pauseStatus=false;
}
开发者ID:AeroCano,项目名称:JdeRobot,代码行数:34,代码来源:pointcloudClient.cpp

示例14: getTestEndpoint

int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
#ifdef ICE_CPP11_MAPPING
    communicator->getValueFactoryManager()->add(makeFactory<II>(), "::Test::I");
    communicator->getValueFactoryManager()->add(makeFactory<JI>(), "::Test::J");
    communicator->getValueFactoryManager()->add(makeFactory<HI>(), "::Test::H");
#else
    Ice::ValueFactoryPtr factory = new MyValueFactory;
    communicator->getValueFactoryManager()->add(factory, "::Test::I");
    communicator->getValueFactoryManager()->add(factory, "::Test::J");
    communicator->getValueFactoryManager()->add(factory, "::Test::H");
#endif

    communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
    Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
    adapter->add(ICE_MAKE_SHARED(InitialI, adapter), communicator->stringToIdentity("initial"));
    adapter->add(ICE_MAKE_SHARED(TestIntfI), communicator->stringToIdentity("test"));

    adapter->add(ICE_MAKE_SHARED(UnexpectedObjectExceptionTestI), communicator->stringToIdentity("uoet"));
    adapter->activate();
    TEST_READY
    communicator->waitForShutdown();
    return EXIT_SUCCESS;
}
开发者ID:chenbk85,项目名称:ice,代码行数:25,代码来源:Server.cpp

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


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