本文整理汇总了C++中PropertyDict::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyDict::empty方法的具体用法?C++ PropertyDict::empty怎么用?C++ PropertyDict::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyDict
的用法示例。
在下文中一共展示了PropertyDict::empty方法的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: catch
bool
MetricsViewI::addOrUpdateMap(const PropertiesPtr& properties, const string& mapName,
const MetricsMapFactoryPtr& factory, const ::Ice::LoggerPtr& logger)
{
const string viewPrefix = "IceMX.Metrics." + _name + ".";
const string mapsPrefix = viewPrefix + "Map.";
PropertyDict mapsProps = properties->getPropertiesForPrefix(mapsPrefix);
string mapPrefix;
PropertyDict mapProps;
if(!mapsProps.empty())
{
mapPrefix = mapsPrefix + mapName + ".";
mapProps = properties->getPropertiesForPrefix(mapPrefix);
if(mapProps.empty())
{
// This map isn't configured for this view.
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end())
{
q->second->destroy();
_maps.erase(q);
return true;
}
return false;
}
}
else
{
mapPrefix = viewPrefix;
mapProps = properties->getPropertiesForPrefix(mapPrefix);
}
if(properties->getPropertyAsInt(mapPrefix + "Disabled") > 0)
{
// This map is disabled for this view.
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end())
{
q->second->destroy();
_maps.erase(q);
return true;
}
return false;
}
map<string, MetricsMapIPtr>::iterator q = _maps.find(mapName);
if(q != _maps.end() && q->second->getProperties() == mapProps)
{
return false; // The map configuration didn't change, no need to re-create.
}
if(q != _maps.end())
{
// Destroy the previous map
q->second->destroy();
_maps.erase(q);
}
try
{
_maps.insert(make_pair(mapName, factory->create(mapPrefix, properties)));
}
catch(const std::exception& ex)
{
::Ice::Warning warn(logger);
warn << "unexpected exception while creating metrics map:\n" << ex;
}
catch(const string& msg)
{
::Ice::Warning warn(logger);
warn << msg;
}
return true;
}