Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/generator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorvariabletracker.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importedentity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importsource.cpp
Expand Down Expand Up @@ -91,6 +92,7 @@ set(GIT_API_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/enums.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/generator.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/generatorprofile.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/generatorvariabletracker.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importedentity.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importer.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importsource.h
Expand Down Expand Up @@ -137,6 +139,7 @@ set(GIT_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile_p.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofilesha1values.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorvariabletracker_p.h
${CMAKE_CURRENT_SOURCE_DIR}/internaltypes.h
${CMAKE_CURRENT_SOURCE_DIR}/issue_p.h
${CMAKE_CURRENT_SOURCE_DIR}/logger_p.h
Expand Down
1 change: 1 addition & 0 deletions src/api/libcellml/analyserequation.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class LIBCELLML_EXPORT AnalyserEquation
{
friend class Analyser;
friend class Generator;
friend class GeneratorVariableTracker;

public:
/**
Expand Down
1 change: 0 additions & 1 deletion src/api/libcellml/analysermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class LIBCELLML_EXPORT AnalyserModel
#endif
{
friend class Analyser;
friend class Generator;

public:
/**
Expand Down
237 changes: 44 additions & 193 deletions src/api/libcellml/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

#pragma once

#include "libcellml/generatorvariabletracker.h"
#include "libcellml/logger.h"

namespace libcellml {
Expand Down Expand Up @@ -47,245 +48,95 @@ class LIBCELLML_EXPORT Generator: public Logger
static GeneratorPtr create() noexcept;

/**
* @brief Get the @ref GeneratorProfile.
*
* Get the @ref GeneratorProfile used by this @ref Generator.
*
* @return The @ref GeneratorProfile used.
*/
GeneratorProfilePtr profile();

/**
* @brief Set the @ref GeneratorProfile.
*
* Set the @ref GeneratorProfile to be used by this @ref Generator.
*
* @param profile The @ref GeneratorProfile to set.
*/
void setProfile(const GeneratorProfilePtr &profile);

/**
* @brief Test if the given @p analyserVariable is tracked.
*
* Test if the given @p analyserVariable is tracked.
*
* @param analyserVariable The pointer to the @ref AnalyserVariable to test.
*
* @return @c true if the analyser variable is tracked, @c false otherwise.
*/
bool isTrackedVariable(const AnalyserVariablePtr &analyserVariable);

/**
* @brief Test if the given @p analyserVariable is untracked.
*
* Test if the given @p analyserVariable is untracked.
*
* @param analyserVariable The pointer to the @ref AnalyserVariable to test.
*
* @return @c true if the analyser variable is untracked, @c false otherwise.
*/
bool isUntrackedVariable(const AnalyserVariablePtr &analyserVariable);

/**
* @brief Track the given @p analyserVariable.
*
* Track the given @p analyserVariable. This will add the analyser variable to the list of tracked variables.
*
* @param analyserVariable The pointer to the @ref AnalyserVariable to track.
*/
void trackVariable(const AnalyserVariablePtr &analyserVariable);

/**
* @brief Untrack the given @p analyserVariable.
*
* Untrack the given @p analyserVariable. This will remove the analyser variable from the list of tracked variables.
*
* @param analyserVariable The pointer to the @ref AnalyserVariable to untrack.
*/
void untrackVariable(const AnalyserVariablePtr &analyserVariable);

/**
* @brief Track all the constants in the given @p analyserModel.
*
* Track all the constants in the given @p analyserModel. This will add all the constants in the analyser model to
* the list of tracked variables.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the constants are to be tracked.
*/
void trackAllConstants(const AnalyserModelPtr &analyserModel);

/**
* @brief Untrack all the constants in the given @p analyserModel.
*
* Untrack all the constants in the given @p analyserModel. This will remove all the constants in the analyser model
* from the list of tracked variables.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the constants are to be untracked.
*/
void untrackAllConstants(const AnalyserModelPtr &analyserModel);

/**
* @brief Track all the computed constants in the given @p analyserModel.
* @brief Get the interface code for the @ref AnalyserModel.
*
* Track all the computed constants in the given @p analyserModel. This will add all the computed constants in the
* analyser model to the list of tracked variables.
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorProfile and the @ref GeneratorVariableTracker.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the computed constants are to be tracked.
*/
void trackAllComputedConstants(const AnalyserModelPtr &analyserModel);

/**
* @brief Untrack all the computed constants in the given @p analyserModel.
*
* Untrack all the computed constants in the given @p analyserModel. This will remove all the computed constants in
* the analyser model from the list of tracked variables.
* @param analyserModel The @ref AnalyserModel for which we want to generate some interface code.
* @param generatorProfile The @ref GeneratorProfile to use to generate the interface code.
* @param generatorVariableTracker The @ref GeneratorVariableTracker to use to generate the interface code
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the computed constants are to be untracked.
* @return The interface code as a @c std::string.
*/
void untrackAllComputedConstants(const AnalyserModelPtr &analyserModel);

/**
* @brief Track all the algebraic variables in the given @p analyserModel.
*
* Track all the algebraic variables in the given @p analyserModel. This will add all the algebraic variables in the
* analyser model to the list of tracked variables.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the algebraic variables are to be tracked.
*/
void trackAllAlgebraicVariables(const AnalyserModelPtr &analyserModel);
std::string interfaceCode(const AnalyserModelPtr &analyserModel, const GeneratorProfilePtr &generatorProfile, const GeneratorVariableTrackerPtr &generatorVariableTracker);

/**
* @brief Untrack all the algebraic variables in the given @p analyserModel.
*
* Untrack all the algebraic variables in the given @p analyserModel. This will remove all the algebraic variables in the
* analyser model from the list of tracked variables.
* @brief Get the interface code for the @ref AnalyserModel.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the algebraic variables are to be untracked.
*/
void untrackAllAlgebraicVariables(const AnalyserModelPtr &analyserModel);

/**
* @brief Track all the variables in the given @p analyserModel.
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* Track all the variables in the given @p analyserModel. This will add all the variables in the analyser model to
* the list of tracked variables. This includes all the constants, computed constants, and algebraic variables.
* @param analyserModel The @ref AnalyserModel for which we want to generate some interface code.
* @param generatorProfile The @ref GeneratorProfile to use to generate the interface code.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the variables are to be tracked.
* @return The interface code as a @c std::string.
*/
void trackAllVariables(const AnalyserModelPtr &analyserModel);

/**
* @brief Untrack all the variables in the given @p analyserModel.
*
* Untrack all the variables in the given @p analyserModel. This will remove all the variables in the analyser model
* from the list of tracked variables. This includes all the constants, computed constants, and algebraic variables.
*
* @param analyserModel The pointer to the @ref AnalyserModel which all the variables are to be untracked.
*/
void untrackAllVariables(const AnalyserModelPtr &analyserModel);
std::string interfaceCode(const AnalyserModelPtr &analyserModel, const GeneratorProfilePtr &generatorProfile);

/**
* @brief Get the number of tracked constants in the given @p analyserModel.
* @brief Get the interface code for the @ref AnalyserModel.
*
* Get the number of tracked constants in the given @p analyserModel.
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorVariableTracker.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of tracked constants.
* @param analyserModel The @ref AnalyserModel for which we want to generate some interface code.
* @param generatorVariableTracker The @ref GeneratorVariableTracker to use to generate the interface code
*
* @return The number of tracked constants in the analyser model.
* @return The interface code as a @c std::string.
*/
size_t trackedConstantCount(const AnalyserModelPtr &analyserModel);

/**
* @brief Get the number of untracked constants in the given @p analyserModel.
*
* Get the number of untracked constants in the given @p analyserModel.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of untracked constants.
*
* @return The number of untracked constants in the analyser model.
*/
size_t untrackedConstantCount(const AnalyserModelPtr &analyserModel);
std::string interfaceCode(const AnalyserModelPtr &analyserModel, const GeneratorVariableTrackerPtr &generatorVariableTracker);

/**
* @brief Get the number of tracked computed constants in the given @p analyserModel.
* @brief Get the interface code for the @ref AnalyserModel.
*
* Get the number of tracked computed constants in the given @p analyserModel.
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of tracked computed
* constants.
* @param analyserModel The @ref AnalyserModel for which we want to generate some interface code.
*
* @return The number of tracked computed constants in the analyser model.
* @return The interface code as a @c std::string.
*/
size_t trackedComputedConstantCount(const AnalyserModelPtr &analyserModel);
std::string interfaceCode(const AnalyserModelPtr &analyserModel);

/**
* @brief Get the number of untracked computed constants in the given @p analyserModel.
* @brief Get the implementation code for the @ref AnalyserModel.
*
* Get the number of untracked computed constants in the given @p analyserModel.
* Return the implementation code for the @ref AnalyserModel, using the @ref GeneratorProfile and the @ref GeneratorVariableTracker.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of untracked computed
* constants.
* @param analyserModel The @ref AnalyserModel for which we want to generate some implementation code.
* @param generatorProfile The @ref GeneratorProfile to use to generate the implementation code.
* @param generatorVariableTracker The @ref GeneratorVariableTracker to use to generate the implementation code
*
* @return The number of untracked computed constants in the analyser model.
* @return The implementation code as a @c std::string.
*/
size_t untrackedComputedConstantCount(const AnalyserModelPtr &analyserModel);

/**
* @brief Get the number of tracked algebraic variables in the given @p analyserModel.
*
* Get the number of tracked algebraic variables in the given @p analyserModel.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of tracked algebraic
* variables.
*
* @return The number of tracked algebraic variables in the analyser model.
*/
size_t trackedAlgebraicCount(const AnalyserModelPtr &analyserModel);
std::string implementationCode(const AnalyserModelPtr &analyserModel, const GeneratorProfilePtr &generatorProfile, const GeneratorVariableTrackerPtr &generatorVariableTracker);

/**
* @brief Get the number of untracked algebraic variables in the given @p analyserModel.
* @brief Get the implementation code for the @ref AnalyserModel.
*
* Get the number of untracked algebraic variables in the given @p analyserModel.
* Return the implementation code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of untracked algebraic
* variables.
* @param analyserModel The @ref AnalyserModel for which we want to generate some implementation code.
* @param generatorProfile The @ref GeneratorProfile to use to generate the implementation code.
*
* @return The number of untracked algebraic variables in the analyser model.
* @return The implementation code as a @c std::string.
*/
size_t untrackedAlgebraicCount(const AnalyserModelPtr &analyserModel);

/**
* @brief Get the number of tracked variables in the given @p analyserModel.
*
* Get the number of tracked variables in the given @p analyserModel.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of tracked variables.
*
* @return The number of tracked variables in the analyser model.
*/
size_t trackedVariableCount(const AnalyserModelPtr &analyserModel);
std::string implementationCode(const AnalyserModelPtr &analyserModel, const GeneratorProfilePtr &generatorProfile);

/**
* @brief Get the number of untracked variables in the given @p analyserModel.
* @brief Get the implementation code for the @ref AnalyserModel.
*
* Get the number of untracked variables in the given @p analyserModel.
* Return the implementation code for the @ref AnalyserModel, using the @ref GeneratorVariableTracker.
*
* @param analyserModel The pointer to the @ref AnalyserModel for which to get the number of untracked variables.
* @param analyserModel The @ref AnalyserModel for which we want to generate some implementation code.
* @param generatorVariableTracker The @ref GeneratorVariableTracker to use to generate the implementation code
*
* @return The number of untracked variables in the analyser model.
* @return The implementation code as a @c std::string.
*/
size_t untrackedVariableCount(const AnalyserModelPtr &analyserModel);

/**
* @brief Get the interface code for the @ref AnalyserModel.
*
* Return the interface code for the @ref AnalyserModel, using the @ref GeneratorProfile.
*
* @param analyserModel 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 AnalyserModelPtr &analyserModel);
std::string implementationCode(const AnalyserModelPtr &analyserModel, const GeneratorVariableTrackerPtr &generatorVariableTracker);

/**
* @brief Get the implementation code for the @ref AnalyserModel.
Expand Down
Loading
Loading