本文整理汇总了C++中Species::isSetNotes方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::isSetNotes方法的具体用法?C++ Species::isSetNotes怎么用?C++ Species::isSetNotes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::isSetNotes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notes
int
CobraToFbcConverter::convert()
{
int result = LIBSBML_OPERATION_FAILED;
if (mDocument == NULL)
{
return LIBSBML_INVALID_OBJECT;
}
Model* mModel = mDocument->getModel();
if (mModel == NULL)
{
return LIBSBML_INVALID_OBJECT;
}
FbcModelPlugin *plugin =
(FbcModelPlugin*)(mDocument->getModel()->getPlugin("fbc"));
// if we have a fbc model we are done already
if (plugin != NULL || mDocument->getLevel() == 3)
{
return LIBSBML_OPERATION_SUCCESS;
}
std::map<const string, int> chargeMap;
std::map<const string, string> formulaMap;
Model* model = mDocument->getModel();
for (unsigned int i = 0; i < model->getNumSpecies();++i)
{
Species* current = model->getSpecies(i);
bool haveCharge = current->isSetCharge();
if (haveCharge)
{
chargeMap[current->getId()] = current->getCharge();
// need to unset the charge here, as it the call will
// not work once this is an L3 model
current->unsetCharge();
}
if (current->isSetNotes())
{
string originalNotes = current->getNotesString();
string notes(originalNotes);
std::transform(notes.begin(), notes.end(), notes.begin(), ::toupper);
size_t pos = notes.find("FORMULA:");
if (pos != string::npos)
{
size_t end = notes.find("</", pos+9);
if (end != string::npos)
{
string formula = originalNotes.substr(pos + 9, end-(pos+9));
if (formula[0] != '<' && formula[0] != '/' )
{
size_t pos = formula.find_first_not_of(" \n\t\r");
if (pos != std::string::npos)
formulaMap[current->getId()] = formula;
}
}
} // added chemical formula if present
pos = notes.find("CHARGE:");
if (pos != string::npos && !haveCharge)
{
size_t end = notes.find("</", pos+8);
if (end != string::npos)
{
string formula = originalNotes.substr(pos + 8, end-(pos+8));
if (formula[0] != '<' && formula[0] != '/' )
{
size_t pos = formula.find_first_not_of(" \n\t\r");
if (pos != std::string::npos)
{
int charge;
stringstream str;
str << formula;
str >> charge;
if (charge != 0)
chargeMap[current->getId()] = charge;
}
}