本文整理汇总了C++中ErrorLogger::addWarning方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorLogger::addWarning方法的具体用法?C++ ErrorLogger::addWarning怎么用?C++ ErrorLogger::addWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorLogger
的用法示例。
在下文中一共展示了ErrorLogger::addWarning方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCellEdited
void ModulePropertyWindow::onCellEdited(const Glib::ustring& path_string,
const Glib::ustring& new_text)
{
if(!m_pModule)
return;
if(m_pAppWindow)
m_pAppWindow->setModified();
ErrorLogger* logger = ErrorLogger::Instance();
Gtk::TreePath path(path_string);
//Get the row from the path:
Gtk::TreeModel::iterator iter = m_refTreeModel->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
//Put the new value in the model:
Glib::ustring strName = Glib::ustring(row[m_Columns.m_col_name]);
if(strName == "Deployer")
{
if(strlen(m_pModule->getHost()) &&
!compareString(m_pModule->getHost(), "localhost") &&
(new_text == "local"))
{
logger->addWarning("local deployer cannot be used to deploy a module on the remote host.");
m_pParent->reportErrors();
return;
}
}
if(strName == "Node")
{
if(compareString(m_pModule->getBroker(), "local") &&
new_text.size() && (new_text != "localhost"))
{
OSTRINGSTREAM msg;
msg<<new_text.c_str()<<" cannot be used with local deployer!";
logger->addWarning(msg);
m_pParent->reportErrors();
Gtk::TreeModel::Row row;
if(getRowByName("Deployer", &row))
{
row[m_Columns.m_col_value] = "";
updateModule("Deployer", "");
}
}
}
row[m_Columns.m_col_value] = new_text;
updateParamteres();
updateModule(strName.c_str(), new_text.c_str());
}
}
示例2: parsXml
Application* XmlAppLoader::parsXml(const char* szFile)
{
app.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return NULL;
}
/* retrieving root element */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return NULL;
}
if(!compareString(root->Value(), "application"))
{
//OSTRINGSTREAM err;
//err<<"File "<<szFile<<" has no tag <application>.";
//logger->addError(err);
return NULL;
}
/* retrieving name */
TiXmlElement* name = (TiXmlElement*) root->FirstChild("name");
if(!name || !name->GetText())
{
OSTRINGSTREAM err;
err<<"Module from "<<szFile<<" has no name.";
logger->addError(err);
//return NULL;
}
app.setXmlFile(szFile);
if(name)
{
string strname = name->GetText();
for(unsigned int i=0; i<strname.size(); i++)
if(strname[i] == ' ')
strname[i] = '_';
app.setName(strname.c_str());
}
/* retrieving description */
TiXmlElement* desc;
if((desc = (TiXmlElement*) root->FirstChild("description")))
app.setDescription(desc->GetText());
/* retrieving version */
TiXmlElement* ver;
if((ver = (TiXmlElement*) root->FirstChild("version")))
app.setVersion(ver->GetText());
/*
* TODO: setting prefix of the main application is inactivated.
* Check this should be supported in future or not!
*/
/*
//retrieving application prefix
TiXmlElement* pref;
if((pref = (TiXmlElement*) root->FirstChild("prefix")))
app.setPrefix(pref->GetText());
*/
/* retrieving authors information*/
TiXmlElement* authors;
if((authors = (TiXmlElement*) root->FirstChild("authors")))
for(TiXmlElement* ath = authors->FirstChildElement(); ath;
ath = ath->NextSiblingElement())
{
if(compareString(ath->Value(), "author"))
{
Author author;
if(ath->GetText())
author.setName(ath->GetText());
if(ath->Attribute("email"))
author.setEmail(ath->Attribute("email"));
app.addAuthor(author);
}
else
{
OSTRINGSTREAM war;
war<<"Unrecognized tag from "<<szFile<<" at line "\
<<ath->Row()<<".";
logger->addWarning(war);
}
//.........这里部分代码省略.........
示例3: parsXml
Module* XmlModLoader::parsXml(const char* szFile)
{
module.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return nullptr;
}
/* retrieving root module */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return nullptr;
}
if(!compareString(root->Value(), "module"))
{
/*
OSTRINGSTREAM msg;
msg<<szFile<<" is not a module descriptor file.";
logger->addWarning(msg);
*/
return nullptr;
}
/* retrieving name */
auto* name = (TiXmlElement*) root->FirstChild("name");
if(!name || !name->GetText())
{
OSTRINGSTREAM err;
err<<"Module from "<<szFile<<" has no name.";
logger->addError(err);
//return NULL;
}
for(TiXmlElement* var = root->FirstChildElement("var"); var; var = var->NextSiblingElement())
{
if(var->Attribute("name") && var->GetText())
{
parser->addVariable(var->Attribute("name"), var->GetText());
}
}
module.setXmlFile(szFile);
if(name)
module.setName(parser->parseText(name->GetText()).c_str());
/* retrieving description */
TiXmlElement* desc;
if((desc = (TiXmlElement*) root->FirstChild("description")))
module.setDescription(parser->parseText(desc->GetText()).c_str());
/* retrieving version */
TiXmlElement* ver;
if((ver = (TiXmlElement*) root->FirstChild("version")))
module.setVersion(parser->parseText(ver->GetText()).c_str());
/* retrieving parameter */
TiXmlElement* arguments;
if((arguments = (TiXmlElement*) root->FirstChild("arguments")))
for(TiXmlElement* param = arguments->FirstChildElement(); param;
param = param->NextSiblingElement())
{
if(compareString(param->Value(), "param"))
{
if(param->GetText())
{
bool brequired = false;
if(compareString(param->Attribute("required"), "yes"))
brequired = true;
Argument arg(parser->parseText(param->GetText()).c_str(),
brequired,
param->Attribute("desc"));
arg.setDefault(param->Attribute("default"));
module.addArgument(arg);
}
}
else
if(compareString(param->Value(), "switch"))
{
if(param->GetText())
{
bool brequired = false;
if(compareString(param->Attribute("required"), "yes"))
brequired = true;
Argument arg(parser->parseText(param->GetText()).c_str(),
//.........这里部分代码省略.........
示例4: parsXml
bool XmlResLoader::parsXml(const char* szFile)
{
computers.clear();
ErrorLogger* logger = ErrorLogger::Instance();
TiXmlDocument doc(szFile);
if(!doc.LoadFile())
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" at line "\
<<doc.ErrorRow()<<": ";
err<<doc.ErrorDesc();
logger->addError(err);
return false;
}
/* retrieving root module */
TiXmlElement *root = doc.RootElement();
if(!root)
{
OSTRINGSTREAM err;
err<<"Syntax error while loading "<<szFile<<" . ";
err<<"No root element.";
logger->addError(err);
return false;
}
if(!compareString(root->Value(), "resources"))
{
/*
OSTRINGSTREAM msg;
msg<<szFile<<" is not a resource descriptor file.";
logger->addWarning(msg);
*/
return false;
}
/* retrieving all computers descriptions */
for(TiXmlElement* restag = root->FirstChildElement();
restag; restag = restag->NextSiblingElement())
{
/* retrieving a computer resource */
if(compareString(restag->Value(), "computer"))
{
Computer computer;
computer.setXmlFile(szFile);
for(TiXmlElement* comptag = restag->FirstChildElement();
comptag; comptag = comptag->NextSiblingElement())
{
/* retrieving name */
if(compareString(comptag->Value(), "name"))
computer.setName(comptag->GetText());
/* retrieving description */
if(compareString(comptag->Value(), "description"))
computer.setDescription(comptag->GetText());
/* retrieving disablility */
if(compareString(comptag->Value(), "disable"))
{
if(compareString(comptag->GetText(), "yes"))
computer.setDisable(true);
}
// platform
if(compareString(comptag->Value(), "platform"))
{
Platform os;
TiXmlElement* element;
if((element = (TiXmlElement*) comptag->FirstChild("name")))
os.setName(element->GetText());
else
{
OSTRINGSTREAM war;
war<<"Platform from "<<szFile<<" at line "\
<<comptag->Row()<<" has no name.";
logger->addWarning(war);
}
if((element = (TiXmlElement*) comptag->FirstChild("distribution")))
os.setDistribution(element->GetText());
if((element = (TiXmlElement*) comptag->FirstChild("release")))
os.setRelease(element->GetText());
computer.setPlatform(os);
} // end of platform tag
// memory
if(compareString(comptag->Value(), "memory"))
{
Memory mem;
TiXmlElement* element;
if((element = (TiXmlElement*) comptag->FirstChild("total_space")))
mem.setTotalSpace((Capacity)atol(element->GetText()));
computer.setMemory(mem);
} // end of memory tag
// storage
//.........这里部分代码省略.........
示例5: validate
bool Arbitrator::validate(void)
{
ErrorLogger* logger = ErrorLogger::Instance();
if(!trainWeights())
return false;
#ifdef WITH_YARPMATH
//#if (GSL_MAJOR_VERSION >= 1 && GSL_MINOR_VERSION >= 14)
int n = alphas.size();
if(n == 0)
return true;
yarp::sig::Matrix A(n, n);
std::map<std::string, std::map<std::string, double> >::iterator itr; // iterating over rows
std::map<std::string, std::map<std::string, double> >::iterator jtr; // iterating over cols
int row = 0;
for(itr=alphas.begin(); itr!=alphas.end(); itr++)
{
std::map<std::string, double>& w = itr->second;
int col = 0;
for(jtr=alphas.begin(); jtr!=alphas.end(); jtr++)
{
std::string opnd = jtr->first;
if(w.find(opnd) != w.end())
A(row,col) = w[opnd];
else
A(row,col) = 0.0;
col++;
}
row++;
}
//printf("%s\n\n", A.toString(1).c_str());
yarp::sig::Vector real;
yarp::sig::Vector img;
yarp::math::eingenValues(A, real, img);
bool bStable = true;
for(size_t i=0; i<real.size(); i++)
{
if((float)fabs(real[i]) >= 1.0)
{
bStable = false;
logger->addError("Inconsistency in logical expressions. This will result an unstable arbitration system!");
break;
}
}
return bStable;
/*
gsl_vector_complex *eval = gsl_vector_complex_alloc(n);
gsl_matrix_complex *evec = gsl_matrix_complex_alloc(n, n);
gsl_eigen_nonsymmv_workspace * w = gsl_eigen_nonsymmv_alloc(n);
gsl_eigen_nonsymmv ((gsl_matrix *)A.getGslMatrix(), eval, evec, w);
bool bStable = true;
for(int i=0; i<n; i++)
{
gsl_complex eval_i = gsl_vector_complex_get (eval, i);
if((float)fabs(GSL_REAL(eval_i)) >= 1.0)
{
bStable = false;
logger->addError("Inconsistency in logical expressions. This will result an unstable arbitration system!");
break;
}
//printf ("eigenvalue = %.2f + %.2fi\n", GSL_REAL(eval_i), GSL_IMAG(eval_i));
}
gsl_eigen_nonsymmv_free(w);
gsl_vector_complex_free(eval);
gsl_matrix_complex_free(evec);
return bStable;
*/
//#else //GSL_VERSION
// logger->addWarning("The version of GNU Scientific Library (GSL) used in libYarpMath is insufficient (GSL_VERSION < 1.14). Your compact logical expression might result an unstable arbitration system!");
// return true;
//#endif //GSL_VERSION
#else //WITH_YARPMATH
logger->addWarning("Yarpmanager is compiled without libYarpMath. Your compact logical expression might result an unstable arbitration system!");
return true;
#endif //WITH_YARPMATH
}