Skip to content

Commit

Permalink
Generator: removed the model() and setModel() APIs.
Browse files Browse the repository at this point in the history
Indeed, we want to be able to tell the generator to track/untrack some model variables. So, to have those `model()` and `setModel()` methods make the generator model-specific when we want it to be usable for any model, hence now the `interfaceCode()` and `implementationCode()` methods taking a model as a parameter.
  • Loading branch information
agarny committed Oct 16, 2024
1 parent a581c7f commit 3751364
Show file tree
Hide file tree
Showing 7 changed files with 555 additions and 693 deletions.
36 changes: 10 additions & 26 deletions src/api/libcellml/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,50 +67,34 @@ class LIBCELLML_EXPORT Generator
*/
void setProfile(const GeneratorProfilePtr &profile);

/**
* @brief Get the @ref AnalyserModel.
*
* Get the @ref AnalyserModel used by this @ref Generator.
*
* @return The @ref AnalyserModel used.
*/
AnalyserModelPtr model();

/**
* @brief Set the @ref AnalyserModel.
*
* Set the @ref AnalyserModel to be used by this @ref Generator.
*
* @param model The @ref AnalyserModel to set.
*/
void setModel(const AnalyserModelPtr &model);

/**
* @brief Get the interface code for the @ref AnalyserModel.
*
* Return the interface code for the @ref AnalyserModel, using the
* @ref GeneratorProfile.
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* @param model The @ref AnalyserModel for which we want to generate some interface code.
*
* @return The interface code as a @c std::string.
*/
std::string interfaceCode() const;
std::string interfaceCode(const AnalyserModelPtr &model) const;

/**
* @brief Get the implementation code for the @ref AnalyserModel.
*
* Return the implementation code for the @ref AnalyserModel, using the
* @ref GeneratorProfile.
* Return the implementation code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* @param model The @ref AnalyserModel for which we want to generate some implementation code.
*
* @return The implementation code as a @c std::string.
*/
std::string implementationCode() const;
std::string implementationCode(const AnalyserModelPtr &model) const;

/**
* @brief Get the equation code for the given @ref AnalyserEquationAst.
*
* Return the equation code for the given @ref AnalyserEquationAst using @ref GeneratorProfile.
*
* @param ast The @ref AnalyserEquationAst for which we want to generate some code.
* @param ast The @ref AnalyserEquationAst for which we want to generate the equation code.
* @param generatorProfile The @ref GeneratorProfile, if any, to use to generate the equation code. If no
* @ref GeneratorProfile is provided then the default @ref GeneratorProfile is used.
*
Expand All @@ -124,7 +108,7 @@ class LIBCELLML_EXPORT Generator
*
* Return the equation code for the given @ref AnalyserEquationAst using a default @ref GeneratorProfile.
*
* @param ast The @ref AnalyserEquationAst for which we want to generate some code.
* @param ast The @ref AnalyserEquationAst for which we want to generate the equation code.
*
* @return The equation code as a @c std::string.
*/
Expand Down
Loading

0 comments on commit 3751364

Please sign in to comment.