-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'swig:master' into feature/new_objc
- Loading branch information
Showing
35 changed files
with
362 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
%module cpp11_shared_ptr_crtp_upcast | ||
|
||
// Cutdown testcase for assert reported in https://github.com/swig/swig/issues/2768 | ||
// Note that this test has CRTP and %template instantiations for DiscretisedDensity template parameters not fully resolved | ||
|
||
%warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE, | ||
SWIGWARN_CSHARP_MULTIPLE_INHERITANCE, | ||
SWIGWARN_D_MULTIPLE_INHERITANCE, | ||
SWIGWARN_RUBY_MULTIPLE_INHERITANCE, | ||
SWIGWARN_PHP_MULTIPLE_INHERITANCE) stir::DiscretisedDensity<3,float>; | ||
|
||
%include <std_shared_ptr.i> | ||
|
||
%{ | ||
#include <memory> | ||
namespace stir {} | ||
using namespace stir; | ||
%} | ||
|
||
%inline %{ | ||
namespace stir { | ||
// Note: CRTP | ||
template <typename Derived, typename Base, typename Parent = Base> | ||
class RegisteredParsingObject : public Parent { | ||
}; | ||
} | ||
%} | ||
|
||
%shared_ptr(stir::Array<3,float>) | ||
%inline %{ | ||
namespace stir { | ||
template <int num_dimensions, typename elemT> | ||
class Array { | ||
}; | ||
} | ||
%} | ||
%template(FloatArray3D) stir::Array<3,float>; | ||
|
||
%shared_ptr(stir::ExamData); | ||
%inline %{ | ||
namespace stir { | ||
class ExamData { | ||
}; | ||
} | ||
%} | ||
|
||
%shared_ptr(stir::DiscretisedDensity<3,float>) | ||
%inline %{ | ||
namespace stir { | ||
template<int num_dimensions, typename elemT> | ||
class DiscretisedDensity : public ExamData, public Array<num_dimensions,elemT> { | ||
}; | ||
} | ||
%} | ||
|
||
%shared_ptr(stir::DataProcessor<stir::DiscretisedDensity<3,float> >) | ||
%shared_ptr(stir::RegisteredParsingObject< | ||
stir::ChainedDataProcessor<stir::DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> > >) | ||
%shared_ptr(stir::ChainedDataProcessor<stir::DiscretisedDensity<3,float> >) | ||
|
||
%inline %{ | ||
namespace stir { | ||
template <typename DataT> | ||
class DataProcessor { | ||
}; | ||
|
||
template <typename DataT> | ||
class ChainedDataProcessor : public RegisteredParsingObject< ChainedDataProcessor<DataT>, DataProcessor<DataT>, DataProcessor<DataT> > { | ||
}; | ||
} | ||
%} | ||
|
||
// SWIG will qualify Discretised in the %template() declaration even though Discretised | ||
// is not in scope with the 'using namespace stir' below commented out. | ||
//using namespace stir; | ||
%template(Float3DDiscretisedDensity) stir::DiscretisedDensity<3,float>; | ||
%template(DataProcessor3DFloat) stir::DataProcessor<stir::DiscretisedDensity<3,float> >; | ||
%template(RPChainedDataProcessor3DFloat) stir::RegisteredParsingObject< | ||
stir::ChainedDataProcessor<stir::DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> > >; | ||
%template(ChainedDataProcessor3DFloat) stir::ChainedDataProcessor<stir::DiscretisedDensity<3,float> >; | ||
|
||
%inline %{ | ||
void useobject(stir::RegisteredParsingObject< | ||
stir::ChainedDataProcessor<stir::DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> >, | ||
stir::DataProcessor<DiscretisedDensity<3,float> > >) { | ||
} | ||
%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
%module xxx | ||
|
||
%feature("smartptr", noblock=1) AA { std::shared_ptr< AA > } | ||
%feature("smartptr", noblock=1) DD { std::shared_ptr< } | ||
|
||
|
||
struct AA {}; | ||
struct BB : AA {}; | ||
struct CC : AA {}; | ||
struct DD : AA {}; | ||
|
||
%feature("smartptr", noblock=1) YY { std::shared_ptr< YY > } | ||
struct XX {}; | ||
struct YY : XX {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cpp_smartptr_feature.i:8: Warning 520: Derived class 'BB' of 'AA' is not similarly marked as a smart pointer. | ||
cpp_smartptr_feature.i:9: Warning 520: Derived class 'CC' of 'AA' is not similarly marked as a smart pointer. | ||
cpp_smartptr_feature.i:10: Error: Invalid type (std::shared_ptr<) in 'smartptr' feature for class DD. | ||
cpp_smartptr_feature.i:10: Warning 520: Derived class 'DD' of 'AA' is not similarly marked as a smart pointer. | ||
cpp_smartptr_feature.i:14: Warning 520: Base class 'XX' of 'YY' is not similarly marked as a smart pointer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.