本文整理汇总了C++中ice::PropertiesPtr::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertiesPtr::getProperty方法的具体用法?C++ PropertiesPtr::getProperty怎么用?C++ PropertiesPtr::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::PropertiesPtr
的用法示例。
在下文中一共展示了PropertiesPtr::getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializationException
NetworkProxyPtr
IceInternal::createNetworkProxy(const Ice::PropertiesPtr& properties, ProtocolSupport protocolSupport)
{
string proxyHost;
proxyHost = properties->getProperty("Ice.SOCKSProxyHost");
if(!proxyHost.empty())
{
#ifdef ICE_OS_WINRT
throw Ice::InitializationException(__FILE__, __LINE__, "SOCKS proxy not supported with WinRT");
#else
if(protocolSupport == EnableIPv6)
{
throw Ice::InitializationException(__FILE__, __LINE__, "IPv6 only is not supported with SOCKS4 proxies");
}
int proxyPort = properties->getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);
return new SOCKSNetworkProxy(proxyHost, proxyPort);
#endif
}
proxyHost = properties->getProperty("Ice.HTTPProxyHost");
if(!proxyHost.empty())
{
#ifdef ICE_OS_WINRT
throw Ice::InitializationException(__FILE__, __LINE__, "HTTP proxy not supported with WinRT");
#else
return new HTTPNetworkProxy(proxyHost, properties->getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080));
#endif
}
return 0;
}
示例2: 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;
}
}
示例3:
//---------------------------------------------------------------------------
NoteFactory::NoteFactory() {
ServiceI& service = ServiceI::instance();
Ice::PropertiesPtr props = service.getCommunicator()->getProperties();
_database = props->getProperty("Service."+service.getName()+".Database");
_databaseOld = props->getProperty("Service."+service.getName()
+".DatabaseOld");
_noteTable = props->getProperty("Service."+service.getName()+".NoteTable");
}
示例4: SessionServantManager
Ice::ObjectAdapterPtr
RegistryI::setupAdminSessionFactory(const Ice::ObjectAdapterPtr& registryAdapter,
const Ice::ObjectPtr& router,
const IceGrid::LocatorPrx& locator)
{
Ice::PropertiesPtr properties = _communicator->getProperties();
Ice::ObjectAdapterPtr adapter;
SessionServantManagerPtr servantManager;
if(!properties->getProperty("IceGrid.Registry.AdminSessionManager.Endpoints").empty())
{
adapter = _communicator->createObjectAdapter("IceGrid.Registry.AdminSessionManager");
servantManager = new SessionServantManager(adapter, _instanceName, false, getServerAdminCategory(), router, 0);
adapter->addServantLocator(servantManager, "");
}
assert(_reaper);
_adminSessionFactory = new AdminSessionFactory(servantManager, _database, _reaper, this);
if(servantManager)
{
Identity sessionMgrId;
sessionMgrId.category = _instanceName;
sessionMgrId.name = "AdminSessionManager";
Identity sslSessionMgrId;
sslSessionMgrId.category = _instanceName;
sslSessionMgrId.name = "AdminSSLSessionManager";
if(!_master)
{
sessionMgrId.name += "-" + _replicaName;
sslSessionMgrId.name += "-" + _replicaName;
}
adapter->add(new AdminSessionManagerI(_adminSessionFactory), sessionMgrId);
adapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslSessionMgrId);
_wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId());
_wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId());
}
if(adapter)
{
Ice::Identity dummy;
dummy.name = "dummy";
_wellKnownObjects->addEndpoint("AdminSessionManager", adapter->createDirectProxy(dummy));
}
_adminVerifier = getPermissionsVerifier(registryAdapter,
locator,
"IceGrid.Registry.AdminPermissionsVerifier",
properties->getProperty("IceGrid.Registry.AdminCryptPasswords"));
_sslAdminVerifier = getSSLPermissionsVerifier(locator, "IceGrid.Registry.AdminSSLPermissionsVerifier");
return adapter;
}
示例5: main
int main(int argc, char** argv)
{
Ice::ObjectPtr viewerPtr;
//signal(SIGINT,signalHandler);
Ice::CommunicatorPtr ic;
try{
ic = EasyIce::initialize(argc, argv);
Ice::PropertiesPtr prop = ic->getProperties();
std::string Endpoints = prop->getProperty("Visualization.Endpoints");
// Naming Service
int nsActive = prop->getPropertyAsIntWithDefault("NamingService.Enabled", 0);
if (nsActive)
{
std::string ns_proxy = prop->getProperty("NamingService.Proxy");
try
{
namingService = new jderobot::ns(ic, ns_proxy);
}
catch (Ice::ConnectionRefusedException& ex)
{
jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
exit(-1);
}
}
Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints("Visualization", Endpoints);
std::string objPrefix("Visualization.");
std::string viewerName = prop->getProperty(objPrefix + "Name");
Ice::ObjectPtr object = new visualization::VisualizationI(objPrefix, ic);
adapter->add(object, ic->stringToIdentity(viewerName));
if (namingService)
namingService->bind(viewerName, Endpoints, object->ice_staticId());
adapter->activate();
ic->waitForShutdown();
}catch (const Ice::Exception& ex) {
std::cerr << ex<<" 1 " << std::endl;
exit(-1);
} catch (const char* msg) {
std::cerr << msg<< " 2 " << std::endl;
exit(-1);
}
}
示例6:
Controller::Controller(Ice::PropertiesPtr prop, int w, int h, int nCameras) {
cameras.resize(nCameras);
this->gladepath = resourcelocator::findGladeFile("rgbdManualCalibrator.glade");
this->world = prop->getProperty("rgbdManualCalibrator.World.File");
//cout << "world es " << this->world << endl;
this->camOut = prop->getProperty("rgbdManualCalibrator.Camera.FileOut");
cWidth=w;
cHeight=h;
this->drawCenter = false;
/*Init world and configurations*/
this->nCameras=nCameras;
this->init(prop, nCameras);
}
示例7: 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);
}
}
示例8: communicator
int
Server::run(int argc, char* argv[])
{
Ice::PropertiesPtr properties = communicator()->getProperties();
Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
args = properties->parseCommandLineOptions("Test", args);
Ice::stringSeqToArgs(args, argc, argv);
string name = properties->getProperty("Ice.ProgramName");
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Server");
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("nonallocatable"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable1"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable2"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable3"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable4"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable11"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable21"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable31"));
adapter->add(new TestI(properties), communicator()->stringToIdentity("allocatable41"));
shutdownOnInterrupt();
try
{
adapter->activate();
}
catch(const Ice::ObjectAdapterDeactivatedException&)
{
}
communicator()->waitForShutdown();
ignoreInterrupt();
return EXIT_SUCCESS;
}
示例9: 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));
}
}
}
示例10: getCVACDataDir
string cvac::getCVACDataDir(const string &detectorNameStr)
{
initIce(detectorNameStr);
Ice::PropertiesPtr props = iceComm->getProperties();
std::string dataDir = props->getProperty("CVAC.DataDir");
return dataDir;
}
示例11: make_pair
IceApp::sensorinfo_t
IceApp::connectToSensor(const std::string &sensor_name) const
{
Ice::PropertiesPtr props = this->communicator()->getProperties();
Ice::LoggerPtr log = this->communicator()->getLogger();
try
{
log->print(string("Connecting to ") + sensor_name + " sensor");
const string prop_name = sensor_name + ".proxy";
string sensor_str_proxy = props->getProperty(prop_name);
sensors::SensorGroupPrx sensor_prx;
if(sensor_str_proxy.empty())
log->warning(prop_name
+ string(" property is not set. No ")
+ sensor_name + ".");
else
{
Ice::ObjectPrx objprx =
this->communicator()->stringToProxy(sensor_str_proxy);
sensor_prx = sensors::SensorGroupPrx::checkedCast(objprx);
if(!sensor_prx)
log->warning(string("Can not connect to ")
+ sensor_name
+ string(" sensor. No ")
+ sensor_name + ".");
else
{
string msg = "Connected to sensor group ";
log->print(msg + sensor_name);
sensors::SensorDescriptionSeq descr =
sensor_prx->getSensorDescription();
for(sensors::SensorDescriptionSeq::const_iterator d = descr.begin();
d != descr.end(); ++d)
{
ostringstream os;
os << " Vendor id: " << d->vendorid << endl;
os << " Description: " << d->description << endl;
os << " Id: " << d->id << endl;
os << " Min value: " << d->minvalue << endl;
os << " Max value: " << d->maxvalue << endl;
os << " Recommended refresh rate, Hz: " << d->refreshrate;
log->print(os.str());
}
return make_pair(sensor_prx, descr);
}
}
}
catch(const Ice::Exception& ex)
{
ostringstream os;
os << "Can not connect to " << sensor_name << " sensor. No "
<< sensor_name + ".\n";
ex.ice_print(os);
log->warning(os.str());
}
return make_pair(sensors::SensorGroupPrx(),
sensors::SensorDescriptionSeq());
}
示例12: out
bool
RegistryI::setupUserAccountMapper(const Ice::ObjectAdapterPtr& registryAdapter)
{
Ice::PropertiesPtr properties = _communicator->getProperties();
//
// Setup file user account mapper object if the property is set.
//
string userAccountFileProperty = properties->getProperty("IceGrid.Registry.UserAccounts");
if(!userAccountFileProperty.empty())
{
try
{
Identity mapperId;
mapperId.category = _instanceName;
mapperId.name = "RegistryUserAccountMapper";
if(!_master)
{
mapperId.name += "-" + _replicaName;
}
registryAdapter->add(new FileUserAccountMapperI(userAccountFileProperty), mapperId);
_wellKnownObjects->add(registryAdapter->createProxy(mapperId), UserAccountMapper::ice_staticId());
}
catch(const std::string& msg)
{
Error out(_communicator->getLogger());
out << msg;
return false;
}
}
return true;
}
示例13: initialize
// Client verbosity
void BowICEI::initialize( DetectorDataArchive* dda,
const ::cvac::FilePath &file,
const::Ice::Current ¤t)
{
// Set CVAC verbosity according to ICE properties
Ice::PropertiesPtr props = (current.adapter->getCommunicator()->getProperties());
string verbStr = props->getProperty("CVAC.ServicesVerbosity");
if (!verbStr.empty())
getVLogger().setLocalVerbosityLevel( verbStr );
// Since constructor only called on service start and destroy
// can be called. We need to make sure we have it
if (pBowCV == NULL)
pBowCV = new bowCV(this);
// Get the default CVAC data directory as defined in the config file
std::string connectName = getClientConnectionName(current);
std::string clientName = mServiceMan->getSandbox()->createClientName(mServiceMan->getServiceName(),
connectName);
std::string clientDir = mServiceMan->getSandbox()->createClientDir(clientName);
string zipfilepath;
if (fInitialized == false)
{ // We are initializing for the first time so load the configModelFileName
if (configModelFileName.empty() && file.filename.empty())
{
localAndClientMsg(VLogger::ERROR, callbackPtr, "No trained model available, aborting.\n" );
return;
}
if (configModelFileName.empty() == false)
{
if (file.filename.empty() == false )
{
localAndClientMsg(VLogger::WARN , callbackPtr, "Detector Preconfigured with a model file so ignoring passed in model %s.\n",
file.filename.c_str() );
}
if (pathAbsolute(configModelFileName))
zipfilepath = configModelFileName;
else
zipfilepath = m_CVAC_DataDir + "/" + configModelFileName;
}
} else if (configModelFileName.empty() == false)
{
if (file.filename.empty() == false)
{
localAndClientMsg(VLogger::WARN , callbackPtr, "Detector Preconfigured with a model file so ignoring passed in model %s.\n",
file.filename.c_str() );
}
return;
}
if (configModelFileName.empty())
zipfilepath = getFSPath(file, m_CVAC_DataDir);
dda->unarchive(zipfilepath, clientDir);
// add the CVAC.DataDir root path and initialize from dda
fInitialized = pBowCV->detect_initialize( dda );
if (!fInitialized)
localAndClientMsg(VLogger::WARN, callbackPtr,"Failed to run CV detect_initialize\n");
}
示例14: invalid_argument
LaserI::LaserI(Ice::PropertiesPtr prop)
{
std::string model = prop->getProperty("Laser.Model");
if ("Hokuyo"==model || "hokuyo"==model){
std::string deviceId = prop->getProperty("Laser.DeviceId");
double min = (double)prop->getPropertyAsInt("Laser.MinAng");
double max = (double)prop->getPropertyAsInt("Laser.MaxAng");
int clustering = prop->getPropertyAsInt("Laser.Clustering");
int faceup = prop->getPropertyAsInt("Laser.FaceUp");
double min_ang = min*M_PI/180;
double max_ang = max*M_PI/180;
this->manager = new hokuyo::HokuyoManager(deviceId, min_ang, max_ang, clustering, -1, faceup);
}else{
throw std::invalid_argument( model + " laser is not allowed" );
}
}
示例15: appName
int
Server::run(int argc, char* argv[])
{
if(argc > 1)
{
cerr << appName() << ": too many arguments" << endl;
return EXIT_FAILURE;
}
Ice::PropertiesPtr properties = communicator()->getProperties();
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
Ice::Identity id = communicator()->stringToIdentity(properties->getProperty("Identity"));
Demo::HelloPtr hello = new HelloI(properties->getProperty("Ice.ProgramName"));
adapter->add(hello, id);
adapter->activate();
communicator()->waitForShutdown();
return EXIT_SUCCESS;
}