PageRenderTime 34ms CodeModel.GetById 32ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/java_pgcpp.i

#
Swig | 56 lines | 40 code | 16 blank | 0 comment | 0 complexity | ee37a72d223d8652719e6574678a5039 MD5 | raw file
 1// Test the premature garbage collection prevention parameter (pgcpp) for the different ways of passing objects
 2
 3%module java_pgcpp
 4
 5%pragma(java) jniclassclassmodifiers="public class"
 6
 7%typemap(javacode) Space::Classic %{
 8  public long getCPtrValue() {
 9    return this.swigCPtr;
10  }
11%}
12
13// Default pointer to pointer typemaps do not use proxy class, so make sure that the pgcpp is generated for these typemaps
14%typemap(jni) Space::Classic ** "jlong"
15%typemap(jtype) Space::Classic ** "long"
16%typemap(jstype) Space::Classic ** " Classic "
17%typemap(javain) Space::Classic ** "Classic.getCPtr($javainput)"
18
19// Default typemaps for pass by value, ref, pointer and pointer const reference should use pgcpp
20
21%inline %{
22namespace Space {
23  struct Classic {
24    Classic() {}
25    Classic(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
26    Classic(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5, bool b) {}
27
28    void method(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
29    void methodconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
30  };
31
32  void function(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
33  void functionconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
34}
35%}
36
37
38%typemap(jtype)  Klassic *k1 "/*a*/ long   /*b*/ /*c*/"
39%typemap(jstype) Klassic *k1 "/*a*/ Classic/*b*/ /*c*/"
40
41%typemap(jtype)  Klassic *k2 "/*d*/ long"
42%typemap(jstype) Klassic *k2 "/*d*/ Classic"
43
44%typemap(jtype)  Klassic *k3 "long/*e*/ "
45%typemap(jstype) Klassic *k3 "Classic/*e*/ "
46
47%typemap(javain) Klassic * "Classic.getCPtr($javainput)"
48
49%{
50typedef Space::Classic Klassic;
51%}
52
53%inline %{
54  void comment_in_typemaps(Klassic *k1, Klassic *k2, Klassic *k3) {}
55%}
56