Skip to content

Commit

Permalink
disable using constructors for SWIG
Browse files Browse the repository at this point in the history
needs SWIG 4.2
  • Loading branch information
KrisThielemans committed Jul 5, 2024
1 parent f79f95b commit 35937dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/include/stir/RegisteredParsingObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ template <typename Derived, typename Base, typename Parent = Base>
class RegisteredParsingObject : public Parent
{
public:
#ifndef SWIG
// import constructors from Parent
// Note: currently disabled for SWIG as that needs SWIG 4.2
using Parent::Parent;
#endif

//! Construct a new object (of type Derived) by parsing the istream
/*! When the istream * is 0, questions are asked interactively.
Expand All @@ -95,6 +99,7 @@ class RegisteredParsingObject : public Parent
inline std::string parameter_info() override;

public:
#ifndef SWIG
//! A helper class to allow automatic registration.
struct RegisterIt
{
Expand All @@ -113,18 +118,19 @@ class RegisteredParsingObject : public Parent
*/
~RegisterIt()
{
#if 0
# if 0
// does not work yet, as registry might be destructed before this
// RegisterIt object. A solution to this problem is coming up.
cerr << "In RegisterIt destructor for " << Derived::registered_name<<endl;
cerr <<"Current keys: ";
Parent::registry().list_keys(cerr);
Parent::registry().remove_from_registry(Derived::registered_name);
#endif
# endif
}
};
// RegisterIt needs to be a friend to have access to registry()
friend struct RegisterIt;
#endif
};

END_NAMESPACE_STIR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ class CudaRelativeDifferencePrior : public RegisteredParsingObject<CudaRelativeD
public:
// Name which will be used when parsing a GeneralisedPrior object
inline static const char* const registered_name = "Cuda Relative Difference Prior";
// Constructors
#ifndef SWIG
// import constructors from base_type
// Note: currently disabled for SWIG as that needs SWIG 4.2
using base_type::base_type;
#endif

// Overridden methods
double compute_value(const DiscretisedDensity<3, elemT>& current_image_estimate) override;
Expand Down

0 comments on commit 35937dd

Please sign in to comment.