Commit a5d091a6c0e4cfe6b40c9f9fc41c2baf6c9e0f1a

Authored by Jürgen Knödlseder
1 parent e40e2904

Add typemap for automatic conversion of GOptimizer class

Showing 1 changed file with 21 additions and 0 deletions
pyext/ctlikelihood.i
... ... @@ -72,6 +72,27 @@ public:
72 72 // arguments to GApplication constructor
73 73 %include "argcargv.i"
74 74  
  75 +/* __ Include interface classes __________________________________________ */
  76 +%import(module="gammalib.opt") "GOptimizer.i";
  77 +
  78 +/* __ Typemaps ___________________________________________________________ */
  79 +%typemap(out) GOptimizer* {
  80 + char classname[80];
  81 + strcpy(classname, "_p_");
  82 + strcat(classname, result->classname().c_str());
  83 + swig_type_info *myinfo = SWIGTYPE_p_GOptimizer;
  84 + swig_cast_info *mycast = 0;
  85 + mycast = myinfo->cast;
  86 + while (mycast != 0) {
  87 + if (strcmp(classname, mycast->type->name) == 0) {
  88 + myinfo = mycast->type;
  89 + break;
  90 + }
  91 + mycast = mycast->next;
  92 + }
  93 + $result = SWIG_NewPointerObj(SWIG_as_voidptr($1), myinfo, 0 | 0);
  94 +}
  95 +
75 96  
76 97 /***********************************************************************//**
77 98 * @class ctlikelihood
... ...