Skip to content

Commit

Permalink
Merge pull request #264 from sbmlteam/fbc-fixes
Browse files Browse the repository at this point in the history
Fbc v3 fixes
  • Loading branch information
fbergmann committed Aug 12, 2022
2 parents 326a82a + 9afe394 commit cddb542
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 54 deletions.
12 changes: 6 additions & 6 deletions src/sbml/packages/fbc/extension/FbcExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ LIBSBML_EXTERN
const char*
FbcVariableType_toString(FbcVariableType_t fvt)
{
int min = FBC_FBCVARIABLETYPE_LINEAR;
int max = FBC_FBCVARIABLETYPE_INVALID;
int min = FBC_VARIABLE_TYPE_LINEAR;
int max = FBC_VARIABLE_TYPE_INVALID;

if (fvt < min || fvt > max)
{
Expand All @@ -715,7 +715,7 @@ FbcVariableType_toString(FbcVariableType_t fvt)

/*
* Returns the #FbcVariableType_t enumeration corresponding to the given string
* or @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t} if there is
* or @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t} if there is
* no such match.
*/
LIBSBML_EXTERN
Expand All @@ -733,7 +733,7 @@ FbcVariableType_fromString(const char* code)
}
}

return FBC_FBCVARIABLETYPE_INVALID;
return FBC_VARIABLE_TYPE_INVALID;
}


Expand All @@ -745,8 +745,8 @@ LIBSBML_EXTERN
int
FbcVariableType_isValid(FbcVariableType_t fvt)
{
int min = FBC_FBCVARIABLETYPE_LINEAR;
int max = FBC_FBCVARIABLETYPE_INVALID;
int min = FBC_VARIABLE_TYPE_LINEAR;
int max = FBC_VARIABLE_TYPE_INVALID;

if (fvt < min || fvt >= max)
{
Expand Down
22 changes: 11 additions & 11 deletions src/sbml/packages/fbc/extension/FbcExtension.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ typedef enum
*/
typedef enum
{
FBC_FBCVARIABLETYPE_LINEAR /*!< The fbc fbcvariabletype is @c "linear". */
, FBC_FBCVARIABLETYPE_QUADRATIC /*!< The fbc fbcvariabletype is @c "quadratic". */
, FBC_FBCVARIABLETYPE_INVALID /*!< Invalid FbcVariableType value. */
FBC_VARIABLE_TYPE_LINEAR /*!< The fbc fbcvariabletype is @c "linear". */
, FBC_VARIABLE_TYPE_QUADRATIC /*!< The fbc fbcvariabletype is @c "quadratic". */
, FBC_VARIABLE_TYPE_INVALID /*!< Invalid FbcVariableType value. */
} FbcVariableType_t;


Expand All @@ -494,7 +494,7 @@ typedef enum
* "linear",
* "quadratic",
* "invalid FbcVariableType value",
* or @c NULL if the value is @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID,
* or @c NULL if the value is @sbmlconstant{FBC_VARIABLE_TYPE_INVALID,
* FbcVariableType_t} or another invalid enumeration value.
*
* @copydetails doc_returned_unowned_char
Expand All @@ -510,18 +510,18 @@ FbcVariableType_toString(FbcVariableType_t fvt);

/**
* Returns the #FbcVariableType_t enumeration corresponding to the given string
* or @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t} if there is
* or @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t} if there is
* no such match.
*
* @param code the string to convert to a #FbcVariableType_t.
*
* @return the corresponding #FbcVariableType_t or
* @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t} if no match is
* @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t} if no match is
* found.
*
* @note The matching is case-sensitive: "linear" will return
* @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}, but "Linear"
* will return @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t}.
* @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}, but "Linear"
* will return @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t}.
*
* @if conly
* @memberof Fbc_t
Expand All @@ -539,9 +539,9 @@ FbcVariableType_fromString(const char* code);
* @param fvt the #FbcVariableType_t enumeration to query.
*
* @return @c 1 (true) if the #FbcVariableType_t is
* @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}, or
* @sbmlconstant{FBC_FBCVARIABLETYPE_QUADRATIC, FbcVariableType_t};
* @c 0 (false) otherwise (including @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID,
* @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}, or
* @sbmlconstant{FBC_VARIABLE_TYPE_QUADRATIC, FbcVariableType_t};
* @c 0 (false) otherwise (including @sbmlconstant{FBC_VARIABLE_TYPE_INVALID,
* FbcVariableType_t}).
*
* @if conly
Expand Down
2 changes: 1 addition & 1 deletion src/sbml/packages/fbc/extension/FbcReactionPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ FbcReactionPlugin::writeElements (XMLOutputStream& stream) const
// dont want to write <fbc:geneProductAssociation/>
// so check it actual has something in
if (isSetGeneProductAssociation() == true && getLevel() == 3
&& getPackageVersion() == 2 && getGeneProductAssociation()->getAssociation() != NULL)
&& getPackageVersion() > 1 && getGeneProductAssociation()->getAssociation() != NULL)
{
mGeneProductAssociation->write(stream);
}
Expand Down
14 changes: 7 additions & 7 deletions src/sbml/packages/fbc/sbml/FluxObjective.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ FluxObjective::FluxObjective (unsigned int level, unsigned int version, unsigned
, mReaction ("")
, mCoefficient (numeric_limits<double>::quiet_NaN())
, mIsSetCoefficient (false)
, mVariableType (FBC_FBCVARIABLETYPE_INVALID)
, mVariableType (FBC_VARIABLE_TYPE_INVALID)
{
// set an SBMLNamespaces derived object of this package
setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion));
Expand All @@ -85,7 +85,7 @@ FluxObjective::FluxObjective (FbcPkgNamespaces* fbcns)
, mReaction ("")
, mCoefficient (numeric_limits<double>::quiet_NaN())
, mIsSetCoefficient (false)
, mVariableType (FBC_FBCVARIABLETYPE_INVALID)
, mVariableType (FBC_VARIABLE_TYPE_INVALID)
{
// set the element namespace of this object
setElementNamespace(fbcns->getURI());
Expand Down Expand Up @@ -256,7 +256,7 @@ FluxObjective::isSetCoefficient() const
bool
FluxObjective::isSetVariableType() const
{
return (mVariableType != FBC_FBCVARIABLETYPE_INVALID);
return (mVariableType != FBC_VARIABLE_TYPE_INVALID);
}


Expand Down Expand Up @@ -317,7 +317,7 @@ FluxObjective::setVariableType(const FbcVariableType_t variableType)
{
if (FbcVariableType_isValid(variableType) == 0)
{
mVariableType = FBC_FBCVARIABLETYPE_INVALID;
mVariableType = FBC_VARIABLE_TYPE_INVALID;
return LIBSBML_INVALID_ATTRIBUTE_VALUE;
}
else
Expand Down Expand Up @@ -347,7 +347,7 @@ FluxObjective::setVariableType(const std::string& variableType)
{
mVariableType = FbcVariableType_fromString(variableType.c_str());

if (mVariableType == FBC_FBCVARIABLETYPE_INVALID)
if (mVariableType == FBC_VARIABLE_TYPE_INVALID)
{
return LIBSBML_INVALID_ATTRIBUTE_VALUE;
}
Expand Down Expand Up @@ -444,7 +444,7 @@ FluxObjective::unsetCoefficient()
int
FluxObjective::unsetVariableType()
{
mVariableType = FBC_FBCVARIABLETYPE_INVALID;
mVariableType = FBC_VARIABLE_TYPE_INVALID;
return LIBSBML_OPERATION_SUCCESS;
}

Expand Down Expand Up @@ -1525,7 +1525,7 @@ FluxObjective_getVariableType(const FluxObjective_t * fo)
{
if (fo == NULL)
{
return FBC_FBCVARIABLETYPE_INVALID;
return FBC_VARIABLE_TYPE_INVALID;
}

return fo->getVariableType();
Expand Down
12 changes: 6 additions & 6 deletions src/sbml/packages/fbc/sbml/FluxObjective.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ class LIBSBML_EXTERN FluxObjective : public SBase
* @if clike The value is drawn from the enumeration @ref FbcVariableType_t
* @endif
* The possible values returned by this method are:
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t}
*/
FbcVariableType_t getVariableType() const;

Expand Down Expand Up @@ -1167,9 +1167,9 @@ FluxObjective_getCoefficient(const FluxObjective_t * fo);
* @if clike The value is drawn from the enumeration @ref FbcVariableType_t
* @endif
* The possible values returned by this method are:
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t}
*
* @memberof FluxObjective_t
*/
Expand Down
2 changes: 1 addition & 1 deletion src/sbml/packages/fbc/sbml/KeyValuePair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ KeyValuePair::writeAttributes(XMLOutputStream& stream) const
unsigned int version = getVersion();
unsigned int pkgVersion = getPackageVersion();

if (level == 3 && version == 1 && pkgVersion == 3)
if (level == 3 && pkgVersion == 3)
{
writeL3V1V3Attributes(stream);
}
Expand Down
32 changes: 16 additions & 16 deletions src/sbml/packages/fbc/sbml/UserDefinedConstraintComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ UserDefinedConstraintComponent::UserDefinedConstraintComponent(
, mCoefficient (util_NaN())
, mIsSetCoefficient (false)
, mVariable ("")
, mVariableType (FBC_FBCVARIABLETYPE_INVALID)
, mVariableType (FBC_VARIABLE_TYPE_INVALID)
{
setSBMLNamespacesAndOwn(new FbcPkgNamespaces(level, version, pkgVersion));
}
Expand All @@ -82,7 +82,7 @@ UserDefinedConstraintComponent::UserDefinedConstraintComponent(FbcPkgNamespaces
, mCoefficient (util_NaN())
, mIsSetCoefficient (false)
, mVariable ("")
, mVariableType (FBC_FBCVARIABLETYPE_INVALID)
, mVariableType (FBC_VARIABLE_TYPE_INVALID)
{
setElementNamespace(fbcns->getURI());
loadPlugins(fbcns);
Expand Down Expand Up @@ -260,7 +260,7 @@ UserDefinedConstraintComponent::isSetVariable() const
bool
UserDefinedConstraintComponent::isSetVariableType() const
{
return (mVariableType != FBC_FBCVARIABLETYPE_INVALID);
return (mVariableType != FBC_VARIABLE_TYPE_INVALID);
}


Expand Down Expand Up @@ -380,7 +380,7 @@ UserDefinedConstraintComponent::setVariableType(const FbcVariableType_t
{
if (FbcVariableType_isValid(variableType) == 0)
{
mVariableType = FBC_FBCVARIABLETYPE_INVALID;
mVariableType = FBC_VARIABLE_TYPE_INVALID;
return LIBSBML_INVALID_ATTRIBUTE_VALUE;
}
else
Expand Down Expand Up @@ -412,7 +412,7 @@ UserDefinedConstraintComponent::setVariableType(const std::string&
{
mVariableType = FbcVariableType_fromString(variableType.c_str());

if (mVariableType == FBC_FBCVARIABLETYPE_INVALID)
if (mVariableType == FBC_VARIABLE_TYPE_INVALID)
{
return LIBSBML_INVALID_ATTRIBUTE_VALUE;
}
Expand Down Expand Up @@ -514,7 +514,7 @@ UserDefinedConstraintComponent::unsetVariable()
int
UserDefinedConstraintComponent::unsetVariableType()
{
mVariableType = FBC_FBCVARIABLETYPE_INVALID;
mVariableType = FBC_VARIABLE_TYPE_INVALID;
return LIBSBML_OPERATION_SUCCESS;
}

Expand Down Expand Up @@ -1060,10 +1060,10 @@ UserDefinedConstraintComponent::readAttributes(const XMLAttributes& attributes,
log->logPackageError("fbc", FbcUserDefinedConstraintLOUserDefinedConstraintComponentsAllowedCoreAttributes,
pkgVersion, level, version, details, getLine(), getColumn());
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == NotSchemaConformant)
{
getErrorLog()->remove(NotSchemaConformant);
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == NotSchemaConformant)
{
getErrorLog()->remove(NotSchemaConformant);
}
}
}

Expand Down Expand Up @@ -1091,10 +1091,10 @@ UserDefinedConstraintComponent::readAttributes(const XMLAttributes& attributes,
FbcUserDefinedConstraintComponentAllowedCoreAttributes, pkgVersion,
level, version, details, getLine(), getColumn());
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == NotSchemaConformant)
{
getErrorLog()->remove(NotSchemaConformant);
}
else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == NotSchemaConformant)
{
getErrorLog()->remove(NotSchemaConformant);
}
}
}

Expand Down Expand Up @@ -1294,7 +1294,7 @@ UserDefinedConstraintComponent::writeAttributes(XMLOutputStream& stream) const
unsigned int version = getVersion();
unsigned int pkgVersion = getPackageVersion();

if (level == 3 && version == 1 && pkgVersion == 3)
if (level == 3 && pkgVersion == 3)
{
writeL3V1V3Attributes(stream);
}
Expand Down Expand Up @@ -1477,7 +1477,7 @@ UserDefinedConstraintComponent_getVariableType(const
{
if (udcc == NULL)
{
return FBC_FBCVARIABLETYPE_INVALID;
return FBC_VARIABLE_TYPE_INVALID;
}

return udcc->getVariableType();
Expand Down
12 changes: 6 additions & 6 deletions src/sbml/packages/fbc/sbml/UserDefinedConstraintComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ class LIBSBML_EXTERN UserDefinedConstraintComponent : public SBase
* @if clike The value is drawn from the enumeration @ref FbcVariableType_t
* @endif
* The possible values returned by this method are:
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t}
*/
FbcVariableType_t getVariableType() const;

Expand Down Expand Up @@ -1032,9 +1032,9 @@ UserDefinedConstraintComponent_getVariable(const
* @if clike The value is drawn from the enumeration @ref FbcVariableType_t
* @endif
* The possible values returned by this method are:
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_FBCVARIABLETYPE_INVALID, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_LINEAR, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_QUADRATIC, FbcVariableType_t}
* @li @sbmlconstant{FBC_VARIABLE_TYPE_INVALID, FbcVariableType_t}
*
* @memberof UserDefinedConstraintComponent_t
*/
Expand Down

0 comments on commit cddb542

Please sign in to comment.