Пример #1
0
/*
 * Reads the expected attributes into the member data variables
 */
void
SedRepeatedTask::readAttributes(
                                const LIBSBML_CPP_NAMESPACE_QUALIFIER
                                  XMLAttributes& attributes,
                                const LIBSBML_CPP_NAMESPACE_QUALIFIER
                                  ExpectedAttributes& expectedAttributes)
{
  unsigned int level = getLevel();
  unsigned int version = getVersion();
  unsigned int numErrs;
  bool assigned = false;
  SedErrorLog* log = getErrorLog();

  SedTask::readAttributes(attributes, expectedAttributes);
  numErrs = log->getNumErrors();

  for (int n = numErrs-1; n >= 0; n--)
  {
    if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
    {
      const std::string details = log->getError(n)->getMessage();
      log->remove(SedUnknownCoreAttribute);
      log->logError(SedmlSedRepeatedTaskAllowedAttributes, level, version,
        details);
    }
  }

  // 
  // range SIdRef (use = "optional" )
  // 

  assigned = attributes.readInto("range", mRangeId);

  if (assigned == true)
  {
    if (mRangeId.empty() == true)
    {
      logEmptyString(mRangeId, level, version, "<SedRepeatedTask>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mRangeId) == false)
    {
      logError(SedmlRepeatedTaskRangeIdMustBeRange, level, version, "The "
        "attribute range='" + mRangeId + "' does not conform to the syntax.");
    }
  }

  // 
  // resetModel bool (use = "optional" )
  // 

  mIsSetResetModel = attributes.readInto("resetModel", mResetModel);
}
Пример #2
0
/*
 * Reads the expected attributes into the member data variables
 */
void
SedSimulation::readAttributes(
                              const LIBSBML_CPP_NAMESPACE_QUALIFIER
                                XMLAttributes& attributes,
                              const LIBSBML_CPP_NAMESPACE_QUALIFIER
                                ExpectedAttributes& expectedAttributes)
{
  unsigned int level = getLevel();
  unsigned int version = getVersion();
  unsigned int numErrs;
  bool assigned = false;
  SedErrorLog* log = getErrorLog();

  if (static_cast<SedListOfSimulations*>(getParentSedObject())->size() < 2)
  {
    numErrs = log->getNumErrors();
    for (int n = numErrs-1; n >= 0; n--)
    {
      if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
      {
        const std::string details = log->getError(n)->getMessage();
        log->remove(SedUnknownCoreAttribute);
        log->logError(SedmlLOSimulationsAllowedCoreAttributes, level, version,
          details);
      }
    }
  }

  SedBase::readAttributes(attributes, expectedAttributes);
  numErrs = log->getNumErrors();

  for (int n = numErrs-1; n >= 0; n--)
  {
    if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
    {
      const std::string details = log->getError(n)->getMessage();
      log->remove(SedUnknownCoreAttribute);
      log->logError(SedmlSedSimulationAllowedAttributes, level, version,
        details);
    }
  }

  // 
  // id SId (use = "required" )
  // 

  assigned = attributes.readInto("id", mId);

  if (assigned == true)
  {
    if (mId.empty() == true)
    {
      logEmptyString(mId, level, version, "<SedSimulation>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mId) == false)
    {
      logError(SedmlIdSyntaxRule, level, version, "The id '" + mId + "' does "
        "not conform to the syntax.");
    }
  }
  else
  {
    std::string message = "Sedml attribute 'id' is missing from the "
      "<SedSimulation> element.";
    log->logError(SedmlSimulationAllowedAttributes, level, version, message);
  }

  // 
  // name string (use = "optional" )
  // 

  assigned = attributes.readInto("name", mName);

  if (assigned == true)
  {
    if (mName.empty() == true)
    {
      logEmptyString(mName, level, version, "<SedSimulation>");
    }
  }
}
Пример #3
0
/*
 * Reads the expected attributes into the member data variables
 */
void
SedSetValue::readAttributes(
                            const LIBSBML_CPP_NAMESPACE_QUALIFIER
                              XMLAttributes& attributes,
                            const LIBSBML_CPP_NAMESPACE_QUALIFIER
                              ExpectedAttributes& expectedAttributes)
{
  unsigned int level = getLevel();
  unsigned int version = getVersion();
  unsigned int numErrs;
  bool assigned = false;
  SedErrorLog* log = getErrorLog();

  if (static_cast<SedListOfSetValues*>(getParentSedObject())->size() < 2)
  {
    numErrs = log->getNumErrors();
    for (int n = numErrs-1; n >= 0; n--)
    {
      if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
      {
        const std::string details = log->getError(n)->getMessage();
        log->remove(SedUnknownCoreAttribute);
        log->logError(SedmlLOSetValuesAllowedCoreAttributes, level, version,
          details);
      }
    }
  }

  SedBase::readAttributes(attributes, expectedAttributes);
  numErrs = log->getNumErrors();

  for (int n = numErrs-1; n >= 0; n--)
  {
    if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
    {
      const std::string details = log->getError(n)->getMessage();
      log->remove(SedUnknownCoreAttribute);
      log->logError(SedmlSedSetValueAllowedAttributes, level, version,
        details);
    }
  }

  // 
  // modelReference SIdRef (use = "required" )
  // 

  assigned = attributes.readInto("modelReference", mModelReference);

  if (assigned == true)
  {
    if (mModelReference.empty() == true)
    {
      logEmptyString(mModelReference, level, version, "<SedSetValue>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mModelReference) == false)
    {
      logError(SedmlSetValueModelReferenceMustBeModel, level, version, "The "
        "attribute modelReference='" + mModelReference + "' does not conform to "
          "the syntax.");
    }
  }
  else
  {
    std::string message = "Sedml attribute 'modelReference' is missing from the "
      "<SedSetValue> element.";
    log->logError(SedmlSetValueAllowedAttributes, level, version, message);
  }

  // 
  // symbol string (use = "optional" )
  // 

  assigned = attributes.readInto("symbol", mSymbol);

  if (assigned == true)
  {
    if (mSymbol.empty() == true)
    {
      logEmptyString(mSymbol, level, version, "<SedSetValue>");
    }
  }

  // 
  // target string (use = "optional" )
  // 

  assigned = attributes.readInto("target", mTarget);

  if (assigned == true)
  {
    if (mTarget.empty() == true)
    {
      logEmptyString(mTarget, level, version, "<SedSetValue>");
    }
  }

  // 
  // range SIdRef (use = "optional" )
  // 

  assigned = attributes.readInto("range", mRange);

  if (assigned == true)
  {
    if (mRange.empty() == true)
    {
      logEmptyString(mRange, level, version, "<SedSetValue>");
    }
    else if (SyntaxChecker::isValidSBMLSId(mRange) == false)
    {
      logError(SedmlSetValueRangeMustBeRange, level, version, "The attribute "
        "range='" + mRange + "' does not conform to the syntax.");
    }
  }
}