diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/test-suite/java_pgcpp.i | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/test-suite/java_pgcpp.i')
| -rw-r--r-- | Examples/test-suite/java_pgcpp.i | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Examples/test-suite/java_pgcpp.i b/Examples/test-suite/java_pgcpp.i new file mode 100644 index 0000000..6a50ffe --- /dev/null +++ b/Examples/test-suite/java_pgcpp.i @@ -0,0 +1,56 @@ +// Test the premature garbage collection prevention parameter (pgcpp) for the different ways of passing objects + +%module java_pgcpp + +%pragma(java) jniclassclassmodifiers="public class" + +%typemap(javacode) Space::Classic %{ + public long getCPtrValue() { + return this.swigCPtr; + } +%} + +// Default pointer to pointer typemaps do not use proxy class, so make sure that the pgcpp is generated for these typemaps +%typemap(jni) Space::Classic ** "jlong" +%typemap(jtype) Space::Classic ** "long" +%typemap(jstype) Space::Classic ** " Classic " +%typemap(javain) Space::Classic ** "Classic.getCPtr($javainput)" + +// Default typemaps for pass by value, ref, pointer and pointer reference should use pgcpp + +%inline %{ +namespace Space { + struct Classic { + Classic() {} + Classic(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {} + Classic(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5, bool b) {} + + void method(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {} + void methodconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5) {} + }; + + void function(Classic c1, Classic& c2, Classic* c3, Classic*& c4, Classic** c5) {} + void functionconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*& c4, const Classic** c5) {} +} +%} + + +%typemap(jtype) Klassic *k1 "/*a*/ long /*b*/ /*c*/" +%typemap(jstype) Klassic *k1 "/*a*/ Classic/*b*/ /*c*/" + +%typemap(jtype) Klassic *k2 "/*d*/ long" +%typemap(jstype) Klassic *k2 "/*d*/ Classic" + +%typemap(jtype) Klassic *k3 "long/*e*/ " +%typemap(jstype) Klassic *k3 "Classic/*e*/ " + +%typemap(javain) Klassic * "Classic.getCPtr($javainput)" + +%{ +typedef Space::Classic Klassic; +%} + +%inline %{ + void comment_in_typemaps(Klassic *k1, Klassic *k2, Klassic *k3) {} +%} + |
