cellml_services::MaLaESTransform Interface Reference

cellml_services::MaLaESTransform Interface Reference

A MaLaES transformer, which takes MathML inputs, and produces programming language outputs. More...

Inheritance diagram for cellml_services::MaLaESTransform:
Collaboration diagram for cellml_services::MaLaESTransform:

Public Member Functions

MaLaESResult transform (in cellml_services::CeVAS aCeVAS, in cellml_services::CUSES aCUSES, in cellml_services::AnnotationSet aAnnos, in mathml_dom::MathMLElement aMathML, in cellml_api::CellMLElement aContext, in cellml_api::CellMLVariable aUnitsOf, in cellml_api::CellMLVariable aBoundUnitsOf, in unsigned long aUnitsDiffDegree)
 Converts a MathML expression into the programming language, using the MAL file specification used to compile this transform.
void stripPassthrough (in cellml_api::Model aModel)
 This function is used to modify a model from an untrusted source to make it so no part of the model is likely to be exposed in MaLaES generated code except as alphanumeric characters and _.
wstring wrapNumber (in wstring rawExpression)
 Transforms an expression that evaluates to a number into the corresponding expression used by MaLaES, as defined by the MAL input.
- Public Member Functions inherited from XPCOM::IObject
void add_ref ()
 Called to indicate that some code is keeping an owning reference to the object.
oneway void release_ref ()
 Removes a reference to an object which was created by some other means (e.g.
IObject query_interface (in utf8string id)
 Returns an IObject of the same implementation, which supports a specific interface.

Public Attributes

readonly attribute wstring compileErrors
 A string listing any compile errors that occurred producing this MaLaESTransform.
- Public Attributes inherited from XPCOM::IObject
readonly attribute string objid
 Fetches the ID of the object.
readonly attribute interface_list supported_interfaces
 Fetches all supported interfaces.

Detailed Description

A MaLaES transformer, which takes MathML inputs, and produces programming language outputs.

Definition at line 149 of file MaLaES.idl.

Member Function Documentation

void cellml_services::MaLaESTransform::stripPassthrough ( in cellml_api::Model  aModel)

This function is used to modify a model from an untrusted source to make it so no part of the model is likely to be exposed in MaLaES generated code except as alphanumeric characters and _.

This can be used to help ensure that the CellML API is not exploited. It makes the following changes to the model:

  • Any passthrough csymbols are removed.
  • name attributes on cellml:variable and cellml:component elements, and text node children of mathml:ci elements are changed to contain only characters matching [A-Za-z0-9_] (and whitespace in the case of mathml:ci). Depending on how the API is used, there may be other vectors by which code can get from the model into the generated code; preventing these is the responsibility of the user of the API. Note: This causes imports to be fully instantiated, if not already, and changes the in-memory version of imported models recursively.
MaLaESResult cellml_services::MaLaESTransform::transform ( in cellml_services::CeVAS  aCeVAS,
in cellml_services::CUSES  aCUSES,
in cellml_services::AnnotationSet  aAnnos,
in mathml_dom::MathMLElement  aMathML,
in cellml_api::CellMLElement  aContext,
in cellml_api::CellMLVariable  aUnitsOf,
in cellml_api::CellMLVariable  aBoundUnitsOf,
in unsigned long  aUnitsDiffDegree 
)

Converts a MathML expression into the programming language, using the MAL file specification used to compile this transform.

The AnnoSet can be set up as follows: bvarIndex annotation on a bound variable: what to call the bound variable in the output. expression on a variable: How to represent the variable (when not a derivative) in the output. delayed_expression: How to represent an infinitesimally delayed version of the variable in the output. expression_d<index> on a variable: How to represent the <index>th derivative in the output. delayed_expression_d<index> on a variable: How to represent an infinitesimally delayed version of the <index>th derivative in the output.

Parameters
aCeVASThe CeVAS object to use to find variable sources.
aCUSESThe CUSES object to use for unit conversions.
aAnnosThe annotation set on which to look up variable names.
aMathMLThe MathML element tree to use.
aContextThe CellML element (component or reaction) to use as context for resolving variables.
aUnitsOfA variable into which the value is being stored. Providing this allows MaLaES to apply an appropriate units conversion to the expression. This may be set to null in which case no units conversion will occur on the result.
aBoundUnitsOfA bound variable by which the variable is being differentiated. Providing this allows MaLaES to compute the required units for derivatives.
aUnitsDiffDegreeThe degree to which aUnitsOf is differentiated (0 if it has not been differentiated, 1 for first derivative, and so on).
wstring cellml_services::MaLaESTransform::wrapNumber ( in wstring  rawExpression)

Transforms an expression that evaluates to a number into the corresponding expression used by MaLaES, as defined by the MAL input.

Member Data Documentation

readonly attribute wstring cellml_services::MaLaESTransform::compileErrors

A string listing any compile errors that occurred producing this MaLaESTransform.

Applications should always check this attribute, and if it is set to a non-empty string, should not attempt to use any other operations or attributes on this interface.

Definition at line 158 of file MaLaES.idl.