本文整理汇总了C++中ConfigReader::GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigReader::GetAttribute方法的具体用法?C++ ConfigReader::GetAttribute怎么用?C++ ConfigReader::GetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigReader
的用法示例。
在下文中一共展示了ConfigReader::GetAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConnectInput
/**
* @brief Connect one input given the content of the config. Used by Connect
*
* @param x_inputConfig Config of the input
* @param xr_module Module to connect
* @param x_inputId Id of input
*/
void Manager::ConnectInput(const ConfigReader& x_inputConfig, Module& xr_module, int x_inputId) const
{
// Check if connected to our previous module
try
{
const string& tmp1 = x_inputConfig.GetAttribute("moduleid", "");
const string& tmp2 = x_inputConfig.GetAttribute("outputid", "");
const string& tmp3 = x_inputConfig.GetAttribute("block", "1");
const string& tmp4 = x_inputConfig.GetAttribute("sync", "1");
// Connection of a simple input
if(tmp1 != "" && tmp2 != "")
{
LOG_DEBUG(m_logger, "Connect input " + to_string(x_inputId) + " of module " + xr_module.GetName() + " to output " + tmp1 + ":" + tmp2);
int outputModuleId = boost::lexical_cast<int>(tmp1);
int outputId = boost::lexical_cast<int>(tmp2);
Stream& inputStream = xr_module.RefInputStreamById(x_inputId);
inputStream.SetBlocking(boost::lexical_cast<bool>(tmp3));
inputStream.SetSynchronized(boost::lexical_cast<bool>(tmp4));
Stream& outputStream = RefModuleById(outputModuleId).RefOutputStreamById(outputId);
// Connect input and output streams
inputStream.Connect(&outputStream);
if(xr_module.GetParameters().GetParameterByName("master").GetValueString().empty())
RefModuleById(outputModuleId).AddDependingModule(xr_module);
}
else if(tmp1.empty() && ! tmp2.empty()) throw MkException("Exception while connecting input: missing moduleid in config", LOC);
else if(! tmp1.empty() && tmp2.empty()) throw MkException("Exception while connecting input: missing outputid in config", LOC);
}
catch(MkException& e)
{
LOG_ERROR(m_logger, "Cannot connect input "<<x_inputConfig.GetAttribute("id", "(unknown)")<<" of module "<<xr_module.GetName());
throw;
}
}
示例2:
ParameterStructure::ParameterStructure(const ConfigReader& x_configReader):
m_configReader(x_configReader),
m_moduleName(x_configReader.GetAttribute("name", "unnamed"))
{
m_writeAllParamsToConfig = false;
}