1 2 # define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG) 3 4 namespace Swig { 5 6 class Director { 7 octave_swig_type *self; 8 bool swig_disowned; 9 10 Director(const Director &x); 11 Director &operator=(const Director &rhs); 12 public: 13 14 Director(void *vptr):self(0), swig_disowned(false) { 15 set_rtdir(vptr, this); 16 } 17 18 ~Director() { 19 swig_director_destroyed(self, this); 20 if (swig_disowned) 21 self->decref(); 22 } 23 24 void swig_set_self(octave_swig_type *new_self) { 25 assert(!swig_disowned); 26 self = new_self; 27 } 28 29 octave_swig_type *swig_get_self() const { 30 return self; 31 } 32 33 void swig_disown() { 34 if (swig_disowned) 35 return; 36 swig_disowned = true; 37 self->incref(); 38 } 39 }; 40 41 struct DirectorTypeMismatchException { 42 static void raise(const char *msg) { 43 // ... todo 44 throw(DirectorTypeMismatchException()); 45 } 46 47 static void raise(const octave_value &ov, const char *msg) { 48 // ... todo 49 raise(msg); 50 } 51 }; 52 53 struct DirectorPureVirtualException { 54 static void raise(const char *msg) { 55 // ... todo 56 throw(DirectorPureVirtualException()); 57 } 58 59 static void raise(const octave_value &ov, const char *msg) { 60 // ... todo 61 raise(msg); 62 } 63 }; 64 65 SWIGINTERN rtdir_map* get_rtdir_map() { 66 static swig_module_info *module = 0; 67 if (!module) 68 module = SWIG_GetModule(0); 69 if (!module) 70 return 0; 71 if (!module->clientdata) 72 module->clientdata = new rtdir_map; 73 return (rtdir_map *) module->clientdata; 74 } 75 76 SWIGINTERNINLINE void set_rtdir(void *vptr, Director *d) { 77 rtdir_map* rm = get_rtdir_map(); 78 if (rm) 79 (*rm)[vptr] = d; 80 } 81 82 SWIGINTERNINLINE void erase_rtdir(void *vptr) { 83 rtdir_map* rm = get_rtdir_map(); 84 if (rm) 85 (*rm).erase(vptr); 86 } 87 88 SWIGINTERNINLINE Director *get_rtdir(void *vptr) { 89 rtdir_map* rm = get_rtdir_map(); 90 if (!rm) 91 return 0; 92 rtdir_map::const_iterator pos = rm->find(vptr); 93 Director *rtdir = (pos != rm->end())? pos->second : 0; 94 return rtdir; 95 } 96 97 SWIGRUNTIME void swig_director_destroyed(octave_swig_type *self, Director *d) { 98 self->director_destroyed(d); 99 } 100 101 SWIGRUNTIME octave_swig_type *swig_director_get_self(Director *d) { 102 return d->swig_get_self(); 103 } 104 105 SWIGRUNTIME void swig_director_set_self(Director *d, octave_swig_type *self) { 106 d->swig_set_self(self); 107 } 108 109 } 110 111 SWIGRUNTIME void swig_acquire_ownership(void *vptr) { 112 // assert(0); 113 // ... todo 114 } 115 116 SWIGRUNTIME void swig_acquire_ownership_array(void *vptr) { 117 // assert(0); 118 // ... todo 119 } 120 121 SWIGRUNTIME void swig_acquire_ownership_obj(void *vptr, int own) { 122 // assert(0); 123 // ... todo 124 } 125