本文整理汇总了C++中ice::PropertyDict类的典型用法代码示例。如果您正苦于以下问题:C++ PropertyDict类的具体用法?C++ PropertyDict怎么用?C++ PropertyDict使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyDict类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ex
TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) :
_communicator(communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
_traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
string key;
try
{
key = "IceSSL.TrustOnly";
_all = parse(properties->getProperty(key));
key = "IceSSL.TrustOnly.Client";
_client = parse(properties->getProperty(key));
key = "IceSSL.TrustOnly.Server";
_allServer = parse(properties->getProperty(key));
Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
{
string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
key = p->first;
_server[name] = parse(p->second);
}
}
catch(const ParseException& e)
{
Ice::PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason;
throw ex;
}
}
开发者ID:updowndown,项目名称:myffff,代码行数:29,代码来源:TrustManager.cpp
示例2: FileCache
NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
NodeSessionManager& sessions,
const ActivatorPtr& activator,
const IceUtil::TimerPtr& timer,
const TraceLevelsPtr& traceLevels,
const NodePrx& proxy,
const string& name,
const UserAccountMapperPrx& mapper,
const string& instanceName) :
_communicator(adapter->getCommunicator()),
_adapter(adapter),
_sessions(sessions),
_activator(activator),
_timer(timer),
_traceLevels(traceLevels),
_name(name),
_proxy(proxy),
_redirectErrToOut(false),
_allowEndpointsOverride(false),
_waitTime(0),
_instanceName(instanceName),
_userAccountMapper(mapper),
_platform("IceGrid.Node", _communicator, _traceLevels),
_fileCache(new FileCache(_communicator)),
_serial(1),
_consistencyCheckDone(false)
{
Ice::PropertiesPtr props = _communicator->getProperties();
const_cast<string&>(_dataDir) = _platform.getDataDir();
const_cast<string&>(_serversDir) = _dataDir + "/servers";
const_cast<string&>(_tmpDir) = _dataDir + "/tmp";
const_cast<Ice::Int&>(_waitTime) = props->getPropertyAsIntWithDefault("IceGrid.Node.WaitTime", 60);
const_cast<string&>(_outputDir) = props->getProperty("IceGrid.Node.Output");
const_cast<bool&>(_redirectErrToOut) = props->getPropertyAsInt("IceGrid.Node.RedirectErrToOut") > 0;
const_cast<bool&>(_allowEndpointsOverride) = props->getPropertyAsInt("IceGrid.Node.AllowEndpointsOverride") > 0;
//
// Parse the properties override property.
//
vector<string> overrides = props->getPropertyAsList("IceGrid.Node.PropertiesOverride");
if(!overrides.empty())
{
for(vector<string>::iterator p = overrides.begin(); p != overrides.end(); ++p)
{
if(p->find("--") != 0)
{
*p = "--" + *p;
}
}
Ice::PropertiesPtr p = Ice::createProperties();
p->parseCommandLineOptions("", overrides);
Ice::PropertyDict propDict = p->getPropertiesForPrefix("");
for(Ice::PropertyDict::const_iterator q = propDict.begin(); q != propDict.end(); ++q)
{
_propertiesOverride.push_back(createProperty(q->first, q->second));
}
}
}
开发者ID:chenbk85,项目名称:ice,代码行数:60,代码来源:NodeI.cpp
示例3: createString
static PyObject*
propertiesStr(PropertiesObject* self)
{
assert(self->properties);
Ice::PropertyDict dict;
try
{
dict = (*self->properties)->getPropertiesForPrefix("");
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}
string str;
for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
{
if(p != dict.begin())
{
str.append("\n");
}
str.append(p->first + "=" + p->second);
}
return createString(str);
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:28,代码来源:Properties.cpp
示例4: assert
ZEND_METHOD(Ice_Properties, __toString)
{
if(ZEND_NUM_ARGS() > 0)
{
WRONG_PARAM_COUNT;
}
Ice::PropertiesPtr _this = Wrapper<Ice::PropertiesPtr>::value(getThis() TSRMLS_CC);
assert(_this);
try
{
Ice::PropertyDict val = _this->getPropertiesForPrefix("");
string str;
for(Ice::PropertyDict::const_iterator p = val.begin(); p != val.end(); ++p)
{
if(p != val.begin())
{
str.append("\n");
}
str.append(p->first + "=" + p->second);
}
RETURN_STRINGL(STRCAST(str.c_str()), static_cast<int>(str.length()), 1);
}
catch(const IceUtil::Exception& ex)
{
throwException(ex TSRMLS_CC);
RETURN_NULL();
}
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:30,代码来源:Properties.cpp
示例5: AbortMarshaling
void
IcePy::UpdateCallbackWrapper::updated(const Ice::PropertyDict& dict)
{
AdoptThread adoptThread; // Ensure the current thread is able to call into Python.
PyObjectHandle result = PyDict_New();
if(result.get())
{
for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
{
PyObjectHandle key = createString(p->first);
PyObjectHandle val = createString(p->second);
if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0)
{
return;
}
}
}
PyObjectHandle obj = PyObject_CallMethod(_callback, STRCAST("updated"), STRCAST("O"), result.get());
if(!obj.get())
{
assert(PyErr_Occurred());
throw AbortMarshaling();
}
}
开发者ID:zeroc-ice,项目名称:ice-debian-packaging,代码行数:26,代码来源:PropertiesAdmin.cpp
示例6: if
int
Controller::load_camera_config(Ice::PropertyDict pd, int cam) {
for(Ice::PropertyDict::const_iterator it = pd.begin(); it != pd.end(); it++) {
std::istringstream sTemp;
if((*it).first.compare("rgbdManualCalibrator.Config.Position.X")==0) {
this->cameras[cam].position.X=(float)atof((*it).second.c_str());
this->lastx = this->cameras[cam].position.X;
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Position.Y")==0) {
this->cameras[cam].position.Y=(float)atof((*it).second.c_str());
this->lasty = this->cameras[cam].position.Y;
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Position.Z")==0) {
this->cameras[cam].position.Z=(float)atof((*it).second.c_str());
this->lastz = this->cameras[cam].position.Z;
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Position.H")==0) {
this->cameras[cam].position.H=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.X")==0) {
this->cameras[cam].foa.X=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.Y")==0) {
this->cameras[cam].foa.Y=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.Z")==0) {
this->cameras[cam].foa.Z=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.FOAPosition.H")==0) {
this->cameras[cam].foa.H=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Roll")==0) {
this->cameras[cam].roll=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Fx")==0) {
this->cameras[cam].fdistx=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Fy")==0) {
this->cameras[cam].fdisty=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Skew")==0) {
this->cameras[cam].skew=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.U0")==0) {
this->cameras[cam].u0=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.V0")==0) {
this->cameras[cam].v0=(float)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Columns")==0) {
this->cameras[cam].columns=(int)atof((*it).second.c_str());
}
else if((*it).first.compare("rgbdManualCalibrator.Config.Rows")==0) {
this->cameras[cam].rows=(int)atof((*it).second.c_str());
}
}
}
开发者ID:AeroCano,项目名称:JdeRobot,代码行数:58,代码来源:controller.cpp
示例7:
void
PropsClient::show(const Ice::PropertiesAdminPrx& admin)
{
Ice::PropertyDict props = admin->getPropertiesForPrefix("Demo");
cout << "Server's current settings:" << endl;
for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p)
{
cout << " " << p->first << "=" << p->second << endl;
}
}
开发者ID:Ben1225513527,项目名称:ice-demos,代码行数:10,代码来源:Client.cpp
示例8: getProxy
static PyObject*
communicatorProxyToProperty(CommunicatorObject* self, PyObject* args)
{
//
// We don't want to accept None here, so we can specify ProxyType and force
// the caller to supply a proxy object.
//
PyObject* proxyObj;
PyObject* strObj;
if(!PyArg_ParseTuple(args, STRCAST("O!O"), &ProxyType, &proxyObj, &strObj))
{
return 0;
}
Ice::ObjectPrx proxy = getProxy(proxyObj);
string str;
if(!getStringArg(strObj, "property", str))
{
return 0;
}
assert(self->communicator);
Ice::PropertyDict dict;
try
{
dict = (*self->communicator)->proxyToProperty(proxy, str);
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}
PyObjectHandle result = PyDict_New();
if(result.get())
{
for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p)
{
PyObjectHandle key = createString(p->first);
PyObjectHandle val = createString(p->second);
if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0)
{
return 0;
}
}
}
return result.release();
}
开发者ID:yuanbaopapa,项目名称:ice,代码行数:49,代码来源:Communicator.cpp
示例9: qPrintable
MurmurIce::MurmurIce() {
count = 0;
if (meta->mp.qsIceEndpoint.isEmpty())
return;
Ice::PropertiesPtr ipp = Ice::createProperties();
::Meta::mp.qsSettings->beginGroup("Ice");
foreach(const QString &v, ::Meta::mp.qsSettings->childKeys()) {
ipp->setProperty(u8(v), u8(::Meta::mp.qsSettings->value(v).toString()));
}
::Meta::mp.qsSettings->endGroup();
Ice::PropertyDict props = ippProperties->getPropertiesForPrefix("");
Ice::PropertyDict::iterator i;
for (i=props.begin(); i != props.end(); ++i) {
ipp->setProperty((*i).first, (*i).second);
}
ipp->setProperty("Ice.ImplicitContext", "Shared");
Ice::InitializationData idd;
idd.properties = ipp;
try {
communicator = Ice::initialize(idd);
if (! meta->mp.qsIceSecretWrite.isEmpty()) {
::Ice::ImplicitContextPtr impl = communicator->getImplicitContext();
if (impl)
impl->put("secret", u8(meta->mp.qsIceSecretWrite));
}
adapter = communicator->createObjectAdapterWithEndpoints("Murmur", qPrintable(meta->mp.qsIceEndpoint));
MetaPtr m = new MetaI;
MetaPrx mprx = MetaPrx::uncheckedCast(adapter->add(m, communicator->stringToIdentity("Meta")));
adapter->addServantLocator(new ServerLocator(), "s");
iopServer = new ServerI;
adapter->activate();
foreach(const Ice::EndpointPtr ep, mprx->ice_getEndpoints()) {
qWarning("MurmurIce: Endpoint \"%s\" running", qPrintable(u8(ep->toString())));
}
meta->connectListener(this);
} catch (Ice::Exception &e) {
qCritical("MurmurIce: Initialization failed: %s", qPrintable(u8(e.ice_name())));
}
}
开发者ID:arrai,项目名称:mumble-record,代码行数:48,代码来源:MurmurIce.cpp
示例10: assert
static PyObject*
propertiesGetPropertiesForPrefix(PropertiesObject* self, PyObject* args)
{
PyObject* prefixObj;
if(!PyArg_ParseTuple(args, STRCAST("O"), &prefixObj))
{
return 0;
}
string prefix;
if(!getStringArg(prefixObj, "prefix", prefix))
{
return 0;
}
assert(self->properties);
Ice::PropertyDict dict;
try
{
dict = (*self->properties)->getPropertiesForPrefix(prefix);
}
catch(const Ice::Exception& ex)
{
setPythonException(ex);
return 0;
}
PyObjectHandle result = PyDict_New();
if(result.get())
{
for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p)
{
PyObjectHandle key = createString(p->first);
PyObjectHandle val = createString(p->second);
if(!val.get() || PyDict_SetItem(result.get(), key.get(), val.get()) < 0)
{
return 0;
}
}
}
return result.release();
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:43,代码来源:Properties.cpp
示例11: getProperties
std::map<string, string> client::getPropertyMap(const Ice::PropertiesPtr& properties) const {
Ice::PropertiesPtr props;
if (!properties) {
props = getProperties();
} else {
props = properties;
}
std::map<string, string> pm;
Ice::PropertyDict omeroProperties = props->getPropertiesForPrefix("omero");
Ice::PropertyDict::const_iterator beg = omeroProperties.begin();
Ice::PropertyDict::const_iterator end = omeroProperties.end();
while (beg != end) {
pm[(*beg).first] = (*beg).second;
beg++;
}
Ice::PropertyDict iceProperties = props->getPropertiesForPrefix("Ice");
beg = iceProperties.begin();
end = iceProperties.end();
while (beg != end) {
pm[(*beg).first] = (*beg).second;
beg++;
}
return pm;
}
开发者ID:Daniel-Walther,项目名称:openmicroscopy,代码行数:26,代码来源:client.cpp
示例12: ex
TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) :
_communicator(communicator)
{
Ice::PropertiesPtr properties = communicator->getProperties();
_traceLevel = properties->getPropertyAsInt("IceSSL.Trace.Security");
string key;
try
{
key = "IceSSL.TrustOnly";
parse(properties->getProperty(key), _rejectAll, _acceptAll);
key = "IceSSL.TrustOnly.Client";
parse(properties->getProperty(key), _rejectClient, _acceptClient);
key = "IceSSL.TrustOnly.Server";
parse(properties->getProperty(key), _rejectAllServer, _acceptAllServer);
Ice::PropertyDict dict = properties->getPropertiesForPrefix("IceSSL.TrustOnly.Server.");
for(Ice::PropertyDict::const_iterator p = dict.begin(); p != dict.end(); ++p)
{
string name = p->first.substr(string("IceSSL.TrustOnly.Server.").size());
key = p->first;
list<DistinguishedName> reject, accept;
parse(p->second, reject, accept);
if(!reject.empty())
{
_rejectServer[name] = reject;
}
if(!accept.empty())
{
_acceptServer[name] = accept;
}
}
}
catch(const ParseException& e)
{
Ice::PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "IceSSL: invalid property " + key + ":\n" + e.reason;
throw ex;
}
}
开发者ID:Jonavin,项目名称:ice,代码行数:38,代码来源:TrustManager.cpp
示例13:
orca::ComponentData
getComponentData( const Context& context )
{
orca::ComponentData compData;
compData.name = context.name();
Ice::PropertyDict providesProps =
context.properties()->getPropertiesForPrefix(context.tag()+".Provides");
orca::ProvidedInterface provided;
for ( Ice::PropertyDict::iterator i=providesProps.begin(); i!=providesProps.end(); ++i ) {
provided.name = i->second;
provided.id = "unknown";
compData.provides.push_back( provided );
}
// special cases: add standard interfaces (depending on startup flags)
// first, add the Home interface itself
// std::string homeIdentity = "orca." + context.name().platform + "." + context.name().component + "/Home";
// provided.name = homeIdentity;
// provided.id = "::orca::Home";
// compData.provides.push_back( provided );
//
// if ( interfaceFlag_& TracerInterface ) {
// provided.name = "tracer";
// provided.id = "::orca::Tracer";
// compData.provides.push_back( provided );
// }
//
// if ( interfaceFlag_& StatusInterface ) {
// provided.name = "status";
// provided.id = "::orca::Status";
// compData.provides.push_back( provided );
// }
// NOTE: this will not work if the config file uses long notation for req. interfaces
Ice::PropertyDict requiresProps =
context.properties()->getPropertiesForPrefix(context.tag()+".Requires");
orca::RequiredInterface required;
for ( Ice::PropertyDict::iterator i=requiresProps.begin(); i!=requiresProps.end(); ++i ) {
required.name = orcaice::toInterfaceName( i->second );
required.id = "unknown";
compData.requires.push_back( required );
}
return compData;
}
开发者ID:mjs513,项目名称:orca-robotics,代码行数:46,代码来源:configutils.cpp
示例14: e
void
ServiceI::start(
const string& name,
const CommunicatorPtr& communicator,
const StringSeq& /*args*/)
{
PropertiesPtr properties = communicator->getProperties();
validateProperties(name, properties, communicator->getLogger());
int id = properties->getPropertyAsIntWithDefault(name + ".NodeId", -1);
// If we are using a replicated deployment and if the topic
// manager thread pool max size is not set then ensure it is set
// to some suitably high number. This ensures no deadlocks in the
// replicated case due to call forwarding from replicas to
// coordinators.
if(id != -1 && properties->getProperty(name + ".TopicManager.ThreadPool.SizeMax").empty())
{
properties->setProperty(name + ".TopicManager.ThreadPool.SizeMax", "100");
}
Ice::ObjectAdapterPtr topicAdapter = communicator->createObjectAdapter(name + ".TopicManager");
Ice::ObjectAdapterPtr publishAdapter = communicator->createObjectAdapter(name + ".Publish");
//
// We use the name of the service for the name of the database environment.
//
string instanceName = properties->getPropertyWithDefault(name + ".InstanceName", "IceStorm");
Identity topicManagerId;
topicManagerId.category = instanceName;
topicManagerId.name = "TopicManager";
if(properties->getPropertyAsIntWithDefault(name+ ".Transient", 0) > 0)
{
_instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter, 0);
try
{
TransientTopicManagerImplPtr manager = new TransientTopicManagerImpl(_instance);
_managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(manager, topicManagerId));
}
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->activate();
publishAdapter->activate();
return;
}
if(id == -1) // No replication.
{
_instance = new Instance(instanceName, name, communicator, publishAdapter, topicAdapter);
try
{
_manager = new TopicManagerImpl(_instance);
_managerProxy = TopicManagerPrx::uncheckedCast(topicAdapter->add(_manager->getServant(), topicManagerId));
}
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;
}
}
else
{
// Here we want to create a map of id -> election node
// proxies.
map<int, NodePrx> nodes;
string topicManagerAdapterId = properties->getProperty(name + ".TopicManager.AdapterId");
// We support two possible deployments. The first is a manual
// deployment, the second is IceGrid.
//
// Here we check for the manual deployment
const string prefix = name + ".Nodes.";
Ice::PropertyDict props = properties->getPropertiesForPrefix(prefix);
if(!props.empty())
{
for(Ice::PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
{
int nodeid = atoi(p->first.substr(prefix.size()).c_str());
nodes[nodeid] = NodePrx::uncheckedCast(communicator->propertyToProxy(p->first));
//.........这里部分代码省略.........
开发者ID:herclogon,项目名称:ice,代码行数:101,代码来源:Service.cpp
示例15: if
//.........这里部分代码省略.........
cout << "ok" << endl;
cout << "testing proxyToProperty... " << flush;
b1 = communicator->stringToProxy("test");
b1 = b1->ice_collocationOptimized(true);
b1 = b1->ice_connectionCached(true);
b1 = b1->ice_preferSecure(false);
b1 = b1->ice_endpointSelection(Ice::Ordered);
b1 = b1->ice_locatorCacheTimeout(100);
b1 = b1->ice_invocationTimeout(1234);
Ice::EncodingVersion v = { 1, 0 };
b1 = b1->ice_encodingVersion(v);
Ice::ObjectPrx router = communicator->stringToProxy("router");
router = router->ice_collocationOptimized(false);
router = router->ice_connectionCached(true);
router = router->ice_preferSecure(true);
router = router->ice_endpointSelection(Ice::Random);
router = router->ice_locatorCacheTimeout(200);
router = router->ice_invocationTimeout(1500);
Ice::ObjectPrx locator = communicator->stringToProxy("locator");
locator = locator->ice_collocationOptimized(true);
locator = locator->ice_connectionCached(false);
locator = locator->ice_preferSecure(true);
locator = locator->ice_endpointSelection(Ice::Random);
locator = locator->ice_locatorCacheTimeout(300);
locator = locator->ice_invocationTimeout(1500);
locator = locator->ice_router(Ice::RouterPrx::uncheckedCast(router));
b1 = b1->ice_locator(Ice::LocatorPrx::uncheckedCast(locator));
Ice::PropertyDict proxyProps = communicator->proxyToProperty(b1, "Test");
test(proxyProps.size() == 21);
test(proxyProps["Test"] == "test -t -e 1.0");
test(proxyProps["Test.CollocationOptimized"] == "1");
test(proxyProps["Test.ConnectionCached"] == "1");
test(proxyProps["Test.PreferSecure"] == "0");
test(proxyProps["Test.EndpointSelection"] == "Ordered");
test(proxyProps["Test.LocatorCacheTimeout"] == "100");
test(proxyProps["Test.InvocationTimeout"] == "1234");
test(proxyProps["Test.Locator"] == "locator -t -e " + Ice::encodingVersionToString(Ice::currentEncoding));
// Locator collocation optimization is always disabled.
//test(proxyProps["Test.Locator.CollocationOptimized"] == "1");
test(proxyProps["Test.Locator.ConnectionCached"] == "0");
test(proxyProps["Test.Locator.PreferSecure"] == "1");
test(proxyProps["Test.Locator.EndpointSelection"] == "Random");
test(proxyProps["Test.Locator.LocatorCacheTimeout"] == "300");
test(proxyProps["Test.Locator.InvocationTimeout"] == "1500");
test(proxyProps["Test.Locator.Router"] == "router -t -e " + Ice::encodingVersionToString(Ice::currentEncoding));
test(proxyProps["Test.Locator.Router.CollocationOptimized"] == "0");
test(proxyProps["Test.Locator.Router.ConnectionCached"] == "1");
test(proxyProps["Test.Locator.Router.PreferSecure"] == "1");
test(proxyProps["Test.Locator.Router.EndpointSelection"] == "Random");
test(proxyProps["Test.Locator.Router.LocatorCacheTimeout"] == "200");
test(proxyProps["Test.Locator.Router.InvocationTimeout"] == "1500");
cout << "ok" << endl;
cout << "testing ice_getCommunicator... " << flush;
test(base->ice_getCommunicator() == communicator);
cout << "ok" << endl;
开发者ID:pedia,项目名称:zeroc-ice,代码行数:67,代码来源:AllTests.cpp
示例16: ex
//.........这里部分代码省略.........
{
case PROCESSOR_ARCHITECTURE_AMD64:
_machine = "x64";
break;
case PROCESSOR_ARCHITECTURE_IA64:
_machine = "IA64";
break;
case PROCESSOR_ARCHITECTURE_INTEL:
_machine = "x86";
break;
default:
_machine = "unknown";
break;
};
#else
struct utsname utsinfo;
uname(&utsinfo);
_os = utsinfo.sysname;
_hostname = utsinfo.nodename;
_release = utsinfo.release;
_version = utsinfo.version;
_machine = utsinfo.machine;
#endif
Ice::PropertiesPtr properties = communicator->getProperties();
//
// Try to obtain the number of processor sockets.
//
_nProcessorSockets = properties->getPropertyAsIntWithDefault("IceGrid.Node.ProcessorSocketCount", 0);
if(_nProcessorSockets == 0)
{
#if defined(_WIN32)
_nProcessorSockets = getSocketCount(_traceLevels->logger);
#elif defined(__linux)
IceUtilInternal::ifstream is(string("/proc/cpuinfo"));
set<string> ids;
int nprocessor = 0;
while(is)
{
string line;
getline(is, line);
if(line.find("processor") == 0)
{
nprocessor++;
}
else if(line.find("physical id") == 0)
{
nprocessor--;
ids.insert(line);
}
}
_nProcessorSockets = nprocessor + ids.size();
#else
// Not supported
_nProcessorSockets = 1;
#endif
}
string endpointsPrefix;
if(prefix == "IceGrid.Registry")
{
_name = properties->getPropertyWithDefault("IceGrid.Registry.ReplicaName", "Master");
endpointsPrefix = prefix + ".Client";
}
else
{
_name = properties->getProperty(prefix + ".Name");
endpointsPrefix = prefix;
}
Ice::PropertyDict props = properties->getPropertiesForPrefix(endpointsPrefix);
Ice::PropertyDict::const_iterator p = props.find(endpointsPrefix + ".PublishedEndpoints");
if(p != props.end())
{
_endpoints = p->second;
}
else
{
_endpoints = properties->getProperty(endpointsPrefix + ".Endpoints");
}
string cwd;
if(IceUtilInternal::getcwd(cwd) != 0)
{
throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
}
_cwd = string(cwd);
_dataDir = properties->getProperty(prefix + ".Data");
if(!IceUtilInternal::isAbsolutePath(_dataDir))
{
_dataDir = _cwd + '/' + _dataDir;
}
if(_dataDir[_dataDir.length() - 1] == '/')
{
_dataDir = _dataDir.substr(0, _dataDir.length() - 1);
}
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:101,代码来源:PlatformInfo.cpp
示例17: test
void
allTests(const Ice::CommunicatorPtr& communicator)
{
string ref = "DemoIceBox/admin:default -p 9996 -t 10000";
Ice::ObjectPrx admin = communicator->stringToProxy(ref);
TestFacetPrx facet;
cout << "testing custom facet... " << flush;
{
//
// Test: Verify that the custom facet is present.
//
facet = Test::TestFacetPrx::checkedCast(admin, "TestFacet");
facet->ice_ping();
}
cout << "ok" << endl;
cout << "testing properties facet... " << flush;
{
Ice::PropertiesAdminPrx pa =
Ice::PropertiesAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Properties");
//
// Test: PropertiesAdmin::getProperty()
//
test(pa->getProperty("Prop1") == "1");
test(pa->getProperty("Bogus") == "");
//
// Test: PropertiesAdmin::getProperties()
//
Ice::PropertyDict pd = pa->getPropertiesForPrefix("");
test(pd.size() == 5);
test(pd["Prop1"] == "1");
test(pd["Prop2"] == "2");
test(pd["Prop3"] == "3");
test(pd["Ice.Config"] == "config.service");
test(pd["Ice.ProgramName"] == "IceBox-TestService");
Ice::PropertyDict changes;
//
// Test: PropertiesAdmin::setProperties()
//
Ice::PropertyDict setProps;
setProps["Prop1"] = "10"; // Changed
setProps["Prop2"] = "20"; // Changed
setProps["Prop3"] = ""; // Removed
setProps["Prop4"] = "4"; // Added
setProps["Prop5"] = "5"; // Added
pa->setProperties(setProps);
test(pa->getProperty("Prop1") == "10");
test(pa->getProperty("Prop2") == "20");
test(pa->getProperty("Prop3") == "");
test(pa->getProperty("Prop4") == "4");
test(pa->getProperty("Prop5") == "5");
changes = facet->getChanges();
test(changes.size() == 5);
test(changes["Prop1"] == "10");
test(changes["Prop2"] == "20");
test(changes["Prop3"] == "");
test(changes["Prop4"] == "4");
test(changes["Prop5"] == "5");
pa->setProperties(setProps);
changes = facet->getChanges();
test(changes.empty());
}
cout << "ok" << endl;
cout << "testing metrics admin facet... " << flush;
{
IceMX::MetricsAdminPrx ma = IceMX::MetricsAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Metrics");
Ice::PropertiesAdminPrx pa =
Ice::PropertiesAdminPrx::checkedCast(admin, "IceBox.Service.TestService.Properties");
Ice::StringSeq views;
Ice::StringSeq disabledViews;
views = ma->getMetricsViewNames(disabledViews);
test(views.empty());
Ice::PropertyDict setProps;
setProps["IceMX.Metrics.Debug.GroupBy"] = "id";
setProps["IceMX.Metrics.All.GroupBy"] = "none";
setProps["IceMX.Metrics.Parent.GroupBy"] = "parent";
pa->setProperties(setProps);
pa->setProperties(Ice::PropertyDict());
views = ma->getMetricsViewNames(disabledViews);
test(views.size() == 3);
// Make sure that the IceBox communicator metrics admin is a separate instance.
test(IceMX::MetricsAdminPrx::checkedCast(admin, "Metrics")->getMetricsViewNames(disabledViews).empty());
}
cout << "ok" << endl;
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:97,代码来源:AllTests.cpp
示例18: if
int
PropsClient::run(int argc, char* argv[])
{
if(argc > 1)
{
cerr << appName() << ": too many arguments" << endl;
return EXIT_FAILURE;
}
PropsPrx props = PropsPrx::checkedCast(communicator()->propertyToProxy("Props.Proxy"));
if(!props)
{
cerr << argv[0] << ": invalid proxy" << endl;
return EXIT_FAILURE;
}
Ice::PropertiesAdminPrx admin =
Ice::PropertiesAdminPrx::checkedCast(communicator()->propertyToProxy("Admin.Proxy"));
Ice::PropertyDict batch1;
batch1["Demo.Prop1"] = "1";
batch1["Demo.Prop2"] = "2";
batch1["Demo.Prop3"] = "3";
Ice::PropertyDict batch2;
batch2["Demo.Prop1"] = "10";
batch2["Demo.Prop2"] = ""; // An empty value removes this property
batch2["Demo.Prop3"] = "30";
show(admin);
menu();
char c = 'x';
do
{
try
{
cout << "==> ";
cin >> c;
if(c == '1' || c == '2')
{
Ice::PropertyDict dict = c == '1' ? batch1 : batch2;
cout << "Sending:" << endl;
for(Ice::PropertyDict::iterator p = dict.begin(); p != dict.end(); ++p)
{
if(p->first.find("Demo") == 0)
{
cout << " " << p->first << "=" << p->second << endl;
}
}
cout << endl;
admin->setProperties(dict);
cout << "Changes:" << endl;
Ice::PropertyDict changes = props->getChanges();
if(changes.empty())
{
cout << " None." << endl;
}
else
{
for(Ice::PropertyDict::iterator p = changes.begin(); p != changes.end(); ++p)
{
cout << " " << p->first;
if(p->second.empty())
{
cout << " was removed" << endl;
}
else
{
cout << " is now " << p->second << endl;
}
}
}
}
else if(c == 'c')
{
show(admin);
}
else if(c == 's')
{
props->shutdown();
}
else if(c == 'x')
{
// Nothing to do
}
else if(c == '?')
{
menu();
}
else
{
cout << "unknown command `" << c << "'" << endl;
menu();
}
}
catch(const Ice::Exception& ex)
{
//.........这里部分代码省略.........
开发者ID:Ben1225513527,项目名称:ice-demos,代码行数:101,代码来源:Client.cpp
注:本文中的ice::PropertyDict类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论