libSBML C++ API  5.20.4
ConstraintMacros.h File Reference

Defines the validator constraint "language". More...

Macros

#define END_CONSTRAINT
 
#define EXTERN_CONSTRAINT(Id, Name)
 
#define fail()   mLogMsg = true; return;
 
#define inv(expr)   if (!(expr)) { mLogMsg = true; return; }
 
#define inv_or(expr)   if (expr) { mLogMsg = false; return; } else mLogMsg = true;
 
#define pre(expr)   if (!(expr)) return;
 
#define START_CONSTRAINT(Id, Typename, Varname)
 

Detailed Description

Defines the validator constraint "language".

Author
Ben Bornstein

This file provides C/C++ macros that make it possible to easily define validation rules for SBML. These are called "validation constraints" in SBML (not to be confused with the Constraint object in SBML). The validator works by applying such constraints to a Model object in memory. A constraint can have preconditions, invariants, and log failures. Failures are retrievable as SBMLError objects in the SBMLErrorLog attached to the SBMLDocument containing the model.

Users can define their own additional validation constraints using the facilities in this file and the Validator class. Please consult the code from existing validation constraints for examples about how to use this.

Macro Definition Documentation

◆ END_CONSTRAINT

#define END_CONSTRAINT
Value:
}; \
LIBSBML_CPP_NAMESPACE_END

◆ EXTERN_CONSTRAINT

#define EXTERN_CONSTRAINT (   Id,
  Name 
)

◆ fail

#define fail ( )    mLogMsg = true; return;

◆ inv

#define inv (   expr)    if (!(expr)) { mLogMsg = true; return; }

◆ inv_or

#define inv_or (   expr)    if (expr) { mLogMsg = false; return; } else mLogMsg = true;

◆ pre

#define pre (   expr)    if (!(expr)) return;

◆ START_CONSTRAINT

#define START_CONSTRAINT (   Id,
  Typename,
  Varname 
)
Value:
LIBSBML_CPP_NAMESPACE_BEGIN \
struct VConstraint ## Typename ## Id: public TConstraint<Typename> \
{ \
VConstraint ## Typename ## Id (Validator& V) : \
TConstraint<Typename>(Id, V) { } \
protected: \
void check_ (const Model& m, const Typename& Varname)
Definition: Model.h:485
Definition: VConstraint.h:68
Definition: Validator.h:91