本文整理汇总了C++中ConfigManager::getValueAsInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigManager::getValueAsInt方法的具体用法?C++ ConfigManager::getValueAsInt怎么用?C++ ConfigManager::getValueAsInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager::getValueAsInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkAndRetrieveDSProPtr
JNIEXPORT jint JNICALL Java_us_ihmc_aci_dspro2_DSProLauncher_startNative (JNIEnv *pEnv, jobject joThis)
{
DSPro *pDSPro = checkAndRetrieveDSProPtr (pEnv, joThis);
if (pDSPro == NULL) {
return -1;
}
ConfigManager *pCfgMgr = checkAndRetrieveCfgMgrPtr (pEnv, joThis);
if (pCfgMgr == NULL) {
return -2;
}
DSProProxyServer proxySrv;
const char *pszProxyServerInterface = NULL;
uint16 ui16ProxyServerPort = 56487; // DISPRO_SVC_PROXY_SERVER_PORT_NUMBER;
if (pCfgMgr->hasValue ("aci.disservice.proxy.interface")) {
pszProxyServerInterface = pCfgMgr->getValue ("aci.disservice.proxy.interface");
}
if (pCfgMgr->hasValue ("aci.disservice.proxy.port")) {
ui16ProxyServerPort = (uint16) pCfgMgr->getValueAsInt ("aci.disservice.proxy.port", 56487);
}
if (proxySrv.init (pDSPro, pszProxyServerInterface, ui16ProxyServerPort) != 0) {
if (pLogger != NULL) {
pLogger->logMsg ("main", Logger::L_SevereError,
"DSProProxyServer has failed to initialize\n");
}
return -3;
}
proxySrv.start();
return 0;
}
示例2: addPeers
int DSProUtils::addPeers (DSPro &dspro, ConfigManager &cfgMgr)
{
const char *pszMethodName = "DSProUtils::addPeers";
const uint16 ui16MocketsPort = static_cast<uint16>(cfgMgr.getValueAsInt ("aci.dspro.adaptor.mockets.port", MocketsAdaptor::DEFAULT_PORT));
StringHashset mocketsAddresses;
parsePeers (cfgMgr.getValue ("aci.dspro.adaptor.mockets.peer.addr"), mocketsAddresses);
const int mocketsRc = addPeer (dspro, MOCKETS, mocketsAddresses, ui16MocketsPort);
const uint16 ui16TCPPort = static_cast<uint16>(cfgMgr.getValueAsInt ("aci.dspro.adaptor.tcp.port", TCPAdaptor::DEFAULT_PORT));
StringHashset tcpAddresses;
parsePeers (cfgMgr.getValue ("aci.dspro.adaptor.tcp.peer.addr"), tcpAddresses);
const int iCount = tcpAddresses.getCount();
tcpAddresses.removeAll (mocketsAddresses);
if (iCount > tcpAddresses.getCount()) {
checkAndLogMsg (pszMethodName, Logger::L_Warning,
"trying to connect to the same peer with both Mockets and TCP. "
"The duplicated connections via TCP will be dropped.\n");
}
const int tcpRc = addPeer (dspro, TCP, tcpAddresses, ui16TCPPort);
return (mocketsRc + tcpRc);
}
示例3: main
int main (int argc, char *argv[])
{
_m.lock();
_terminated = false;
_m.unlock();
if (signal (SIGINT, sigIntHandler) == SIG_ERR) {
printf ("Error handling SIGINT\n");
exit (-1);
}
ConfigManager *pConfigManager = NULL;
uint16 ui16Port = DIS_SVC_PROXY_SERVER_PORT_NUMBER;
// Read Configuration
if (argc > 2) {
printf ("Usage: ./DisServiceProxy <configFile>\n");
exit (-2);
}
if (argv[1]) {
if (FileUtils::fileExists(argv[1])) {
pConfigManager = new ConfigManager();
pConfigManager->init();
int rc;
if ((rc = pConfigManager->readConfigFile((const char *) argv[1])) != 0) {
printf ("Error in config file %s reading. Returned code %d.\n", (const char *) argv[1], rc);
exit (-3);
}
if (pConfigManager->hasValue("aci.disservice.proxy.port")) {
ui16Port = (uint16) pConfigManager->getValueAsInt("aci.disservice.proxy.port");
}
if (pConfigManager->getValueAsBool("util.logger.enabled", true)) {
if (!pLogger) {
pLogger = new Logger();
if (pConfigManager->getValueAsBool("util.logger.out.screen.enabled", true)) {
pLogger->enableScreenOutput();
}
if (pConfigManager->getValueAsBool("util.logger.out.file.enabled", true)) {
pLogger->initLogFile (pConfigManager->getValue ("util.logger.out.file.path", "ds.log"), false);
pLogger->enableFileOutput();
pLogger->initErrorLogFile (pConfigManager->getValue ("util.logger.error.file.path", "dserror.log"), false);
pLogger->enableErrorLogFileOutput();
}
uint8 ui8DbgDetLevel = (uint8) pConfigManager->getValueAsInt ("util.logger.detail", Logger::L_LowDetailDebug);
switch (ui8DbgDetLevel) {
case Logger::L_SevereError:
case Logger::L_MildError:
case Logger::L_Warning:
case Logger::L_Info:
case Logger::L_NetDetailDebug:
case Logger::L_LowDetailDebug:
case Logger::L_MediumDetailDebug:
case Logger::L_HighDetailDebug:
pLogger->setDebugLevel (ui8DbgDetLevel);
pLogger->logMsg ("DisServiceLauncher::main", Logger::L_Info,
"Setting debug level to %d\n", ui8DbgDetLevel);
break;
default:
pLogger->setDebugLevel(Logger::L_LowDetailDebug);
pLogger->logMsg("DisServiceLauncher::main",
Logger::L_Info,
"Invalid Logger detail debug level. Setting it to %d\n",
Logger::L_LowDetailDebug);
}
}
}
}
else {
printf ("The file at location: %s does not exist.\n", (const char *) argv[1]);
exit (-4);
}
}
if (pConfigManager == NULL) {
// Default Logger conf
if (!pLogger) {
pLogger = new Logger();
pLogger->enableScreenOutput();
pLogger->initLogFile("disseminationservice.log",false);
pLogger->enableFileOutput();
pLogger->setDebugLevel(Logger::L_LowDetailDebug);
}
}
if (pLogger != NULL) {
pLogger->displayAbsoluteTime();
}
//Initializing and starting DisService
DisseminationService * _pDisService = (pConfigManager ? new DisseminationService(pConfigManager) : new DisseminationService());
int rc;
if (0 != (rc = _pDisService->init())) {
printf ("\nDisseminationService is failed to initialize\n");
return -5;
}
_pDisService->start();
// Initializing and starting ProxyServer
DisseminationServiceProxyServer dsProxyServer;
//.........这里部分代码省略.........