当前位置: 首页>>代码示例>>C++>>正文


C++ CIniParser::Load方法代码示例

本文整理汇总了C++中CIniParser::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ CIniParser::Load方法的具体用法?C++ CIniParser::Load怎么用?C++ CIniParser::Load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CIniParser的用法示例。


在下文中一共展示了CIniParser::Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Init

int CDiscoveryApp::Init( const char * p_szInterface )
{
	char szBuffer[ 64 ];
	sprintf( szBuffer, "/tmp/%s.log", p_szInterface);
	
	if( !CApp::Init( szBuffer ) )
	{	
		LOG("CApp::Init(%s) return 0", szBuffer);
		
		return 0;
	}
	
	if( !m_stCfg.Init( "GLOBAL") )
	{
		LOG("m_stCfg.Init(\"GLOBAL\") return 0");
		
		return 0;
	}
	
	//read ETH_NAME
	CIniParser configParser;
	if(!configParser.Load(RC_NET_INFO) || configParser.GetVar((const char*)NULL, "ETH_NAME", m_szEthInterf, sizeof(m_szEthInterf), 0, false) == 0)
	{
		strcpy(m_szEthInterf, "eth0");
	}
	snprintf(m_szEthInterf_0, READ_BUF_SIZE, "%s:0", m_szEthInterf);
	snprintf(m_szEthInterf_1, READ_BUF_SIZE, "%s:1", m_szEthInterf);

	srand(time(NULL));
	
	LOG( "Init DONE");
	
	return 1;    //all went OK
}
开发者ID:singhshobhit,项目名称:RPL_Node,代码行数:34,代码来源:DiscoveryApp.cpp

示例2: BurstSpecificCmds

// Specific Burst cmds for Gateway Caching
bool GatewayConfig::BurstSpecificCmds()
{
    m_oSpecificBurstCmds.clear();

    CIniParser specificCmdsConfig;
    CIniParser::valuesList burstSpecificCmds;
    if (!specificCmdsConfig.Load(FILE_PATH_CONFIGINI))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!specificCmdsConfig.GetVar("WH_GATEWAY", "BURST_SPECIFIC_CMDS", &burstSpecificCmds))
    {
        return 0;
    }

    CIniParser::valuesList::iterator it = burstSpecificCmds.begin();

    for (; it != burstSpecificCmds.end(); it++)
    {
        CHartCmdWrapper::Ptr cmdTemp(new CHartCmdWrapper);

        cmdTemp->LoadRaw((*it), 0, NULL, 0);
        m_oSpecificBurstCmds.push_back(cmdTemp);

    }

    return 1;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:31,代码来源:GatewayConfig.cpp

示例3: WriteCmdFinalAssemblyNumber

// write Command Final Assembly Number to config_universal.ini file
bool GatewayConfig::WriteCmdFinalAssemblyNumber(uint32_t finalAssemblyNumber)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    else
    {
        int finAssemblyNumber;
        finAssemblyNumber = (int) finalAssemblyNumber;
        if (!gwVarConfig.SetVar("WH_GATEWAY", "FINAL_ASSEMBLY_NUMBER", finAssemblyNumber))
            return 0;

    }
    return 1;

}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:26,代码来源:GatewayConfig.cpp

示例4: ReadSpecificCmds

//Specific Read Cmds for Gateway Caching
bool GatewayConfig::ReadSpecificCmds()
{
    m_oSpecificReadCmds.clear();
    // **********************CIniParser************************//

    CIniParser specificCmdsConfig;
    CIniParser::valuesList readSpecificCmds;
    if (!specificCmdsConfig.Load(FILE_PATH_CONFIGINI))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return false;
    }

    if (!specificCmdsConfig.GetVar("WH_GATEWAY", "READ_SPECIFIC_CMDS", &readSpecificCmds))
    {
        return false;
    }

    CIniParser::valuesList::iterator it = readSpecificCmds.begin();

    for (; it != readSpecificCmds.end(); it++)
    {
        CHartCmdWrapper::Ptr cmdTemp(new CHartCmdWrapper);

        cmdTemp->LoadRaw((*it), 0, NULL, 0);
        m_oSpecificReadCmds.push_back(cmdTemp);

        LOG("ReadSpecificCmds: vmdId=%d", (*it));
    }

    return 1;

}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:34,代码来源:GatewayConfig.cpp

示例5: LoadPidList

int CWatchdogMngr::LoadPidList()
{
	CIniParser oIniParser;

	if ( !oIniParser.Load(m_pPidListFile) )
	{
		throw CWatchdog::exception::exception("Unable to load pidListFile") ;
	}

	LOG("Loaded pidListFile [%s]", m_pPidListFile);

	char*  currentPidList[WTD_PIDLIST_ENTRIES]={0,};
	size_t currentPidListLen=0;
	char   pidFile[256];
	for ( unsigned pos=0
		; oIniParser.GetVar("WTD", "watch", pidFile, sizeof(pidFile), pos)
		  && currentPidListLen < WTD_PIDLIST_ENTRIES
		;  ++pos )
	{
		void*key=pidFile;
		void *el=lfind( &key,currentPidList,&currentPidListLen,sizeof(currentPidList[0]),qsortcmp ) ;
		if ( NULL == el )
		{
			currentPidList[currentPidListLen] = strdup(pidFile);
			LOG( WTD"fw.cfg:[%s]", currentPidList[currentPidListLen] );
			++currentPidListLen ;
		}
	}
	qsort( currentPidList, currentPidListLen, sizeof(currentPidList[0]), qsortcmp );

	/// Check if any pidFile from m_ppPidList is missing from currentPidList.
	for (   unsigned j=0; j < m_nPidListLength && m_ppPidList[j]; ++j )
	{
		void *el=bsearch( &m_ppPidList[j], currentPidList, currentPidListLen, sizeof(currentPidList[0]), qsortcmp) ;
		if ( NULL == el )
		{
			LOG( WTD "STOP watching pid[%s]", m_ppPidList[j]);
			systemf_to( 20, "log2flash 'WTD: STOP watching pid[%s]'&", m_ppPidList[j]);
		}
	}
	/// Free the old list to prepare the copy of the new one.
	clearPidList() ;

	m_nPidListLength=currentPidListLen ;
	m_ppPidList[m_nPidListLength] = 0;

	LOG( WTD"WATCH:%d modules", m_nPidListLength );
	if ( !m_nPidListLength )
	{
		return true ;
	}
	memmove(m_ppPidList, currentPidList, WTD_PIDLIST_ENTRIES*sizeof(currentPidList[0]) );
	for ( unsigned j = 0; j< m_nPidListLength ; j++)
	{
		LOG( WTD "WATCH:[%s]", m_ppPidList[j]);
	}
	return true ;
}
开发者ID:dndusdndus12,项目名称:ISA100.11a-Gateway-1,代码行数:58,代码来源:WatchdogMngr.cpp

示例6: WriteDeviceStatus

// write Device Status to config_universal.ini file
// TODO: Beni - save Device Status on C038_ResetConfigurationChangedFlag
bool GatewayConfig::WriteDeviceStatus(uint8_t deviceStatus)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.SetVar("WH_GATEWAY", "DEVICE_STATUS", deviceStatus))
        return 0;

    m_u8DeviceStatus = deviceStatus;

    return 1;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:18,代码来源:GatewayConfig.cpp

示例7: WriteGwReqMaxRetryNo

bool GatewayConfig::WriteGwReqMaxRetryNo(uint8_t p_u8RetryNo)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_CONFIGINI, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    if (!gwVarConfig.SetVar("WH_GATEWAY", "GW_REQ_MAX_RETRY_NO", p_u8RetryNo, 0, true))
    {
        return 0;
    }
    return 1;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:20,代码来源:GatewayConfig.cpp

示例8: LoadConfig

int CWatchdogMngr::LoadConfig( )
{
	char wtd[16]={0} ;
	int divisor ;
	CIniParser oIniParser;
	if ( !oIniParser.Load(INI_FILE) )
		throw CWatchdog::exception::exception("Unable to parse IniFile") ;

	oIniParser.GetVar("GLOBAL","MODULES_WATCH_DOG", wtd, sizeof(wtd) ) ;

	if(  wtd[0]=='n' || wtd[0]=='N'
	  || wtd[0]=='f' || wtd[0]=='F'
	  || wtd[0]=='0'
	   )
	{
		if ( m_status&CFG_ENABLED )
		{
			m_status&=~CFG_ENABLED ;
			LOG("Disabling watchdog");
		}
	}
	else if ( ! (m_status&CFG_ENABLED) )
	{
		m_status|=CFG_ENABLED;
		LOG("Enabling watchdog");
	}
	// Set the PingDivisor
	if ( oIniParser.GetVar("GLOBAL","WATCH_DOG_DIVISOR", &divisor))
	{
		SetPingDivisor(divisor) ;
	}
	if ( ! oIniParser.GetVar("GLOBAL","FREEMEM_THRESHOLD", &m_nMemThreshold) )
	{
		m_nMemThreshold = 5*1024*1024 ;
	}
	if ( ! oIniParser.GetVar("GLOBAL","FREETMP_THRESHOLD", &m_nTmpThreshold) )
	{
		m_nTmpThreshold = 4*1024*1024 ;
	}
	return (m_status&CFG_ENABLED) ;
}
开发者ID:dndusdndus12,项目名称:ISA100.11a-Gateway-1,代码行数:41,代码来源:WatchdogMngr.cpp

示例9: WriteCmdUniversalMessage

bool GatewayConfig::WriteCmdUniversalMessage(char * universalmessage)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    if (!gwVarConfig.SetVar("WH_GATEWAY", "CMD_UNIVERSAL_MESSAGE", universalmessage))
    {
        return 0;
    }

    return 1;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:21,代码来源:GatewayConfig.cpp

示例10: strcasecmp

enum CWatchdog::Type CWatchdogMngr::GetType()
{
	char wtd[16]={0} ;
	CIniParser oIniParser;

	if ( !oIniParser.Load(INI_FILE) )
		throw CWatchdog::exception::exception("Unable to parse IniFile") ;

	if ( ! oIniParser.GetVar("GLOBAL","WATCH_DOG_TYPE", wtd, sizeof(wtd))
	||   ! strcasecmp(wtd,"internal") )
	{
		LOG( WTD "Using the internal watchdog") ;
		return CWatchdog::WTD_INTERNAL ;
	}

	if ( ! strcasecmp(wtd,"max6371") )
	{
		LOG( WTD "Using the max6371 watchdog") ;
		return CWatchdog::WTD_MAX6371 ;
	}
	return CWatchdog::WTD_INTERNAL ;
}
开发者ID:dndusdndus12,项目名称:ISA100.11a-Gateway-1,代码行数:22,代码来源:WatchdogMngr.cpp

示例11: WriteCmdTag

bool GatewayConfig::WriteCmdTag(char * tag)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("-------NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    else
    {
        if (!gwVarConfig.SetVar("WH_GATEWAY", "TAG", tag))
            return 0;

    }
    return 1;

}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:23,代码来源:GatewayConfig.cpp

示例12: WriteCmdMasterDescriptor

bool GatewayConfig::WriteCmdMasterDescriptor(char * masterDescriptor)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    else
    {
        if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DESCRIPTOR", masterDescriptor))
            return 0;

    }
    return 1;

}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:23,代码来源:GatewayConfig.cpp

示例13: WriteMinRespPreamblesNo

bool GatewayConfig::WriteMinRespPreamblesNo(uint8_t p_u8MinRespPreamblesNo)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("------- NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    int minRespPreamblesNo = p_u8MinRespPreamblesNo;

    if (!gwVarConfig.SetVar("WH_GATEWAY", "MIN_RESP_PREAMBLES_NO", minRespPreamblesNo))
    {
        return 0;
    }

    return 1;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:23,代码来源:GatewayConfig.cpp

示例14: WriteCmdMasterDate

bool GatewayConfig::WriteCmdMasterDate(WHartDate masterDate)
{
    CIniParser gwVarConfig;
    if (!gwVarConfig.Load(FILE_PATH_GW_INFO_UNIV, "r+"))
    {
        LOG("-------NO CONFIG.INI FILE -------");
        return 0;
    }

    if (!gwVarConfig.FindGroup("WH_GATEWAY", true))
    {
        return 0;
    }

    else
    {
        int date_day;
        int date_month;
        int date_year;

        date_day = (int) masterDate.day;
        date_month = (int) masterDate.month;
        date_year = (int) masterDate.year;

        if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_DAY", date_day))
            return 0;

        if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_MONTH", date_month))
            return 0;

        if (!gwVarConfig.SetVar("WH_GATEWAY", "MASTER_DATE_YEAR", date_year))
            return 0;
    }
    return 1;

}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:36,代码来源:GatewayConfig.cpp

示例15: LoadConfigFileWrite

int PublisherConf::LoadConfigFileWrite(const char *pFileName/*[in]*/, CIniParser& parser /*[in/out]*/)
{
	return !parser.Load(pFileName, "r+", true) ? -1 : 0;
}
开发者ID:irares,项目名称:WirelessHart-Gateway,代码行数:4,代码来源:PublisherConf.cpp


注:本文中的CIniParser::Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。