PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // Test the premature garbage collection prevention parameter (pgcpp) for the different ways of passing objects
  2. %module java_pgcpp
  3. %pragma(java) jniclassclassmodifiers="public class"
  4. %typemap(javacode) Space::Classic %{
  5. public long getCPtrValue() {
  6. return this.swigCPtr;
  7. }
  8. %}
  9. // Default pointer to pointer typemaps do not use proxy class, so make sure that the pgcpp is generated for these typemaps
  10. %typemap(jni) Space::Classic ** "jlong"
  11. %typemap(jtype) Space::Classic ** "long"
  12. %typemap(jstype) Space::Classic ** " Classic "
  13. %typemap(javain) Space::Classic ** "Classic.getCPtr($javainput)"
  14. // Default typemaps for pass by value, ref, pointer and pointer const reference should use pgcpp
  15. %inline %{
  16. namespace Space {
  17. struct Classic {
  18. Classic() {}
  19. Classic(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
  20. Classic(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5, bool b) {}
  21. void method(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
  22. void methodconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
  23. };
  24. void function(Classic c1, Classic& c2, Classic* c3, Classic*const& c4, Classic** c5) {}
  25. void functionconst(const Classic c1, const Classic& c2, const Classic* c3, const Classic*const& c4, const Classic** c5) {}
  26. }
  27. %}
  28. %typemap(jtype) Klassic *k1 "/*a*/ long /*b*/ /*c*/"
  29. %typemap(jstype) Klassic *k1 "/*a*/ Classic/*b*/ /*c*/"
  30. %typemap(jtype) Klassic *k2 "/*d*/ long"
  31. %typemap(jstype) Klassic *k2 "/*d*/ Classic"
  32. %typemap(jtype) Klassic *k3 "long/*e*/ "
  33. %typemap(jstype) Klassic *k3 "Classic/*e*/ "
  34. %typemap(javain) Klassic * "Classic.getCPtr($javainput)"
  35. %{
  36. typedef Space::Classic Klassic;
  37. %}
  38. %inline %{
  39. void comment_in_typemaps(Klassic *k1, Klassic *k2, Klassic *k3) {}
  40. %}