本文整理汇总了C++中PropertyDict::find方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyDict::find方法的具体用法?C++ PropertyDict::find怎么用?C++ PropertyDict::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyDict
的用法示例。
在下文中一共展示了PropertyDict::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ex
void
Ice::PluginManagerI::loadPlugins(int& argc, const char* argv[])
{
assert(_communicator);
StringSeq cmdArgs = argsToStringSeq(argc, argv);
const string prefix = "Ice.Plugin.";
PropertiesPtr properties = _communicator->getProperties();
PropertyDict plugins = properties->getPropertiesForPrefix(prefix);
//
// First, load static plugin factories which were setup to load on
// communicator initialization. If a matching plugin property is
// set, we load the plugin with the plugin specification. The
// entryPoint will be ignored but the rest of the plugin
// specification might be used.
//
if(loadOnInitialization)
{
for(vector<string>::const_iterator p = loadOnInitialization->begin(); p != loadOnInitialization->end(); ++p)
{
string property = prefix + *p;
PropertyDict::iterator r = plugins.find(property + ".cpp");
if(r == plugins.end())
{
r = plugins.find(property);
}
else
{
plugins.erase(property);
}
if(r != plugins.end())
{
loadPlugin(*p, r->second, cmdArgs);
plugins.erase(r);
}
else
{
loadPlugin(*p, "", cmdArgs);
}
}
}
//
// Next, load and initialize the plug-ins defined in the property
// set with the prefix "Ice.Plugin.". These properties should have
// the following format:
//
// Ice.Plugin.name[.<language>]=entry_point [args]
//
// If the Ice.PluginLoadOrder property is defined, load the
// specified plug-ins in the specified order, then load any
// remaining plug-ins.
//
StringSeq loadOrder = properties->getPropertyAsList("Ice.PluginLoadOrder");
for(StringSeq::const_iterator p = loadOrder.begin(); p != loadOrder.end(); ++p)
{
string name = *p;
if(findPlugin(name))
{
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "plug-in `" + name + "' already loaded";
throw ex;
}
string property = prefix + name;
PropertyDict::iterator r = plugins.find(property + ".cpp");
if(r == plugins.end())
{
r = plugins.find(property);
}
else
{
plugins.erase(property);
}
if(r != plugins.end())
{
loadPlugin(name, r->second, cmdArgs);
plugins.erase(r);
}
else
{
PluginInitializationException ex(__FILE__, __LINE__);
ex.reason = "plug-in `" + name + "' not defined";
throw ex;
}
}
//
// Load any remaining plug-ins that weren't specified in PluginLoadOrder.
//
while(!plugins.empty())
{
PropertyDict::iterator p = plugins.begin();
//.........这里部分代码省略.........
示例2: ex
bool
IceBox::ServiceManagerI::start()
{
try
{
ServiceManagerPtr obj = this;
PropertiesPtr properties = _communicator->getProperties();
//
// Create an object adapter. Services probably should NOT share
// this object adapter, as the endpoint(s) for this object adapter
// will most likely need to be firewalled for security reasons.
//
ObjectAdapterPtr adapter;
if(properties->getProperty("IceBox.ServiceManager.Endpoints") != "")
{
adapter = _communicator->createObjectAdapter("IceBox.ServiceManager");
Identity identity;
identity.category = properties->getPropertyWithDefault("IceBox.InstanceName", "IceBox");
identity.name = "ServiceManager";
adapter->add(obj, identity);
}
//
// Parse the property set with the prefix "IceBox.Service.". These
// properties should have the following format:
//
// IceBox.Service.Foo=entry_point [args]
//
// We parse the service properties specified in IceBox.LoadOrder
// first, then the ones from remaining services.
//
const string prefix = "IceBox.Service.";
PropertyDict services = properties->getPropertiesForPrefix(prefix);
PropertyDict::iterator p;
StringSeq loadOrder = properties->getPropertyAsList("IceBox.LoadOrder");
vector<StartServiceInfo> servicesInfo;
for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q)
{
p = services.find(prefix + *q);
if(p == services.end())
{
FailureException ex(__FILE__, __LINE__);
ex.reason = "ServiceManager: no service definition for `" + *q + "'";
throw ex;
}
servicesInfo.push_back(StartServiceInfo(*q, p->second, _argv));
services.erase(p);
}
for(p = services.begin(); p != services.end(); ++p)
{
servicesInfo.push_back(StartServiceInfo(p->first.substr(prefix.size()), p->second, _argv));
}
//
// Check if some services are using the shared communicator in which
// case we create the shared communicator now with a property set which
// is the union of all the service properties (services which are using
// the shared communicator).
//
PropertyDict sharedCommunicatorServices = properties->getPropertiesForPrefix("IceBox.UseSharedCommunicator.");
if(!sharedCommunicatorServices.empty())
{
InitializationData initData;
initData.properties = createServiceProperties("SharedCommunicator");
for(vector<StartServiceInfo>::iterator q = servicesInfo.begin(); q != servicesInfo.end(); ++q)
{
if(properties->getPropertyAsInt("IceBox.UseSharedCommunicator." + q->name) <= 0)
{
continue;
}
//
// Load the service properties using the shared communicator properties as
// the default properties.
//
PropertiesPtr svcProperties = createProperties(q->args, initData.properties);
//
// Erase properties from the shared communicator which don't exist in the
// service properties (which include the shared communicator properties
// overriden by the service properties).
//
PropertyDict allProps = initData.properties->getPropertiesForPrefix("");
for(PropertyDict::iterator p = allProps.begin(); p != allProps.end(); ++p)
{
if(svcProperties->getProperty(p->first) == "")
{
initData.properties->setProperty(p->first, "");
}
}
//
// Add the service properties to the shared communicator properties.
//
PropertyDict props = svcProperties->getPropertiesForPrefix("");
for(PropertyDict::const_iterator r = props.begin(); r != props.end(); ++r)
{
initData.properties->setProperty(r->first, r->second);
//.........这里部分代码省略.........
示例3: sync
void
PropertiesAdminI::setProperties_async(const AMD_PropertiesAdmin_setPropertiesPtr& cb, const PropertyDict& props,
const Current&)
{
Lock sync(*this);
PropertyDict old = _properties->getPropertiesForPrefix("");
PropertyDict::const_iterator p;
const int traceLevel = _properties->getPropertyAsInt("Ice.Trace.Admin.Properties");
//
// Compute the difference between the new property set and the existing property set:
//
// 1) Any properties in the new set that were not defined in the existing set.
//
// 2) Any properties that appear in both sets but with different values.
//
// 3) Any properties not present in the new set but present in the existing set.
// In other words, the property has been removed.
//
PropertyDict added, changed, removed;
for(p = props.begin(); p != props.end(); ++p)
{
PropertyDict::iterator q = old.find(p->first);
if(q == old.end())
{
if(!p->second.empty())
{
//
// This property is new.
//
added.insert(*p);
}
}
else
{
if(p->second != q->second)
{
if(p->second.empty())
{
//
// This property was removed.
//
removed.insert(*p);
}
else
{
//
// This property has changed.
//
changed.insert(*p);
}
}
}
}
if(traceLevel > 0 && (!added.empty() || !changed.empty() || !removed.empty()))
{
Trace out(_logger, traceCategory);
out << "Summary of property changes";
if(!added.empty())
{
out << "\nNew properties:";
for(p = added.begin(); p != added.end(); ++p)
{
out << "\n " << p->first;
if(traceLevel > 1)
{
out << " = " << p->second;
}
}
}
if(!changed.empty())
{
out << "\nChanged properties:";
for(p = changed.begin(); p != changed.end(); ++p)
{
out << "\n " << p->first;
if(traceLevel > 1)
{
out << " = " << p->second << " (old value = " << _properties->getProperty(p->first) << ")";
}
}
}
if(!removed.empty())
{
out << "\nRemoved properties:";
for(p = removed.begin(); p != removed.end(); ++p)
{
out << "\n " << p->first;
}
}
}
//
// Update the property set.
//.........这里部分代码省略.........