Skip to content

Commit

Permalink
Generator: make it inherit from Logger.
Browse files Browse the repository at this point in the history
So that we can report issues with regards to trying to track/untrack a variable.
  • Loading branch information
agarny committed Oct 30, 2024
1 parent 4f1d106 commit e60a954
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 69 deletions.
13 changes: 7 additions & 6 deletions src/api/libcellml/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ limitations under the License.

#include <string>

#include "libcellml/exportdefinitions.h"
#include "libcellml/types.h"
#include "libcellml/logger.h"

namespace libcellml {

Expand All @@ -28,7 +27,7 @@ namespace libcellml {
*
* The Generator class is for representing a CellML Generator.
*/
class LIBCELLML_EXPORT Generator
class LIBCELLML_EXPORT Generator: public Logger
{
public:
~Generator(); /**< Destructor, @private. */
Expand Down Expand Up @@ -304,7 +303,7 @@ class LIBCELLML_EXPORT Generator
*
* @return The interface code as a @c std::string.
*/
std::string interfaceCode(const AnalyserModelPtr &model) const;
std::string interfaceCode(const AnalyserModelPtr &model);

/**
* @brief Get the implementation code for the @ref AnalyserModel.
Expand All @@ -315,7 +314,7 @@ class LIBCELLML_EXPORT Generator
*
* @return The implementation code as a @c std::string.
*/
std::string implementationCode(const AnalyserModelPtr &model) const;
std::string implementationCode(const AnalyserModelPtr &model);

/**
* @brief Get the equation code for the given @ref AnalyserEquationAst.
Expand Down Expand Up @@ -346,7 +345,9 @@ class LIBCELLML_EXPORT Generator
Generator(); /**< Constructor, @private. */

struct GeneratorImpl;
GeneratorImpl *mPimpl; /**< Private member to implementation pointer, @private. */

GeneratorImpl *pFunc(); /**< Getter for private implementation pointer, @private. */
const GeneratorImpl *pFunc() const; /**< Const getter for private implementation pointer, @private. */
};

} // namespace libcellml
1 change: 1 addition & 0 deletions src/bindings/interface/generator.i
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
%import "analysermodel.i"
%import "createconstructor.i"
%import "generatorprofile.i"
%import "logger.i"

%feature("docstring") libcellml::Generator
"Creates a :class:`Generator` object.";
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/javascript/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ using namespace emscripten;

EMSCRIPTEN_BINDINGS(libcellml_generator)
{
class_<libcellml::Generator>("Generator")
class_<libcellml::Generator, base<libcellml::Logger>>("Generator")
.smart_ptr_constructor("Generator", &libcellml::Generator::create)
.function("profile", &libcellml::Generator::profile)
.function("setProfile", &libcellml::Generator::setProfile)
Expand Down
Loading

0 comments on commit e60a954

Please sign in to comment.