First round of director mods
- Removed asserts - The unused __DIRECTOR__ base class default constructor removed. I've used the conventional approach of having no default constructor rather than a private one (declaring it private doesn't serve any useful purpose when this constructor is not wanted). git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5132 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
638ec81f42
commit
6e052aeb1d
7 changed files with 0 additions and 29 deletions
|
|
@ -18,8 +18,6 @@ class __DIRECTOR__ {
|
|||
private:
|
||||
/* pointer to java virtual machine */
|
||||
JavaVM *__jvm;
|
||||
/* the default constructor should not be called */
|
||||
__DIRECTOR__();
|
||||
|
||||
protected:
|
||||
/* pointer to the wrapped java object */
|
||||
|
|
@ -27,13 +25,11 @@ protected:
|
|||
/* Acquire Java VM environment from Java VM */
|
||||
JNIEnv *__acquire_jenv() const {
|
||||
JNIEnv *env;
|
||||
assert(__jvm);
|
||||
__jvm->AttachCurrentThread((void **) &env, NULL);
|
||||
return env;
|
||||
}
|
||||
|
||||
public:
|
||||
/* Default constructor */
|
||||
__DIRECTOR__(JNIEnv *jenv):
|
||||
__jvm((JavaVM *) NULL),
|
||||
__self(NULL)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
%}
|
||||
|
||||
%insert(runtime) %{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
%insert(runtime) %{
|
||||
|
||||
#include <assert.h>
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
|
|
@ -61,11 +60,6 @@ private:
|
|||
#endif
|
||||
|
||||
public:
|
||||
/* the default constructor should not be called */
|
||||
__DIRECTOR__() {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/* wrap a ocaml object, optionally taking ownership */
|
||||
__DIRECTOR__(CAML_VALUE self, int disown): _self(self), _disown(disown) {
|
||||
register_global_root(&_self);
|
||||
|
|
@ -125,7 +119,6 @@ public:
|
|||
/* acquire ownership of the wrapped ocaml object (the sense of "disown"
|
||||
* is from ocaml) */
|
||||
void __disown() const {
|
||||
assert(_self);
|
||||
if (!_disown) {
|
||||
_disown=1;
|
||||
callback(*caml_named_value("caml_obj_disown"),_self);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,6 @@ private:
|
|||
|
||||
/* decrement the reference count of the wrapped python object */
|
||||
void __decref() const {
|
||||
assert(_self);
|
||||
if (_disown) {
|
||||
Py_DECREF(_self);
|
||||
}
|
||||
|
|
@ -93,11 +92,6 @@ private:
|
|||
#endif
|
||||
|
||||
public:
|
||||
/* the default constructor should not be called */
|
||||
__DIRECTOR__() {
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/* wrap a python object, optionally taking ownership */
|
||||
__DIRECTOR__(PyObject* self, int disown): _self(self), _disown(disown) {
|
||||
__incref();
|
||||
|
|
@ -155,7 +149,6 @@ public:
|
|||
/* acquire ownership of the wrapped python object (the sense of "disown"
|
||||
* is from python) */
|
||||
void __disown() const {
|
||||
assert(_self);
|
||||
if (!_disown) {
|
||||
_disown=1;
|
||||
__incref();
|
||||
|
|
@ -164,7 +157,6 @@ public:
|
|||
|
||||
/* increase the reference count of the wrapped python object */
|
||||
void __incref() const {
|
||||
assert(_self);
|
||||
if (_disown) {
|
||||
Py_INCREF(_self);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -473,7 +473,6 @@
|
|||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
assert($input);
|
||||
}
|
||||
}
|
||||
%typemap(inv) SWIGTYPE * {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
|
||||
struct swig_body_args
|
||||
|
|
@ -99,11 +98,6 @@ private:
|
|||
#endif
|
||||
|
||||
public:
|
||||
/* the default constructor should not be called */
|
||||
__DIRECTOR__() {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
/* wrap a Ruby object, optionally taking ownership */
|
||||
__DIRECTOR__(VALUE self, bool disown) : _self(self), _disown(disown) {
|
||||
}
|
||||
|
|
@ -159,7 +153,6 @@ public:
|
|||
/* acquire ownership of the wrapped Ruby object (the sense of "disown"
|
||||
* is from Ruby) */
|
||||
void __disown() const {
|
||||
assert(_self);
|
||||
if (!_disown) {
|
||||
_disown = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,7 +431,6 @@
|
|||
} else {
|
||||
$input = proxy->__get_self();
|
||||
}
|
||||
assert($input);
|
||||
}
|
||||
}
|
||||
%typemap(inv) SWIGTYPE * {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue