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/SWIG@5132 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
842055ed5d
commit
a7933a75b0
7 changed files with 0 additions and 29 deletions
|
|
@ -18,8 +18,6 @@ class __DIRECTOR__ {
|
||||||
private:
|
private:
|
||||||
/* pointer to java virtual machine */
|
/* pointer to java virtual machine */
|
||||||
JavaVM *__jvm;
|
JavaVM *__jvm;
|
||||||
/* the default constructor should not be called */
|
|
||||||
__DIRECTOR__();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* pointer to the wrapped java object */
|
/* pointer to the wrapped java object */
|
||||||
|
|
@ -27,13 +25,11 @@ protected:
|
||||||
/* Acquire Java VM environment from Java VM */
|
/* Acquire Java VM environment from Java VM */
|
||||||
JNIEnv *__acquire_jenv() const {
|
JNIEnv *__acquire_jenv() const {
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
assert(__jvm);
|
|
||||||
__jvm->AttachCurrentThread((void **) &env, NULL);
|
__jvm->AttachCurrentThread((void **) &env, NULL);
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Default constructor */
|
|
||||||
__DIRECTOR__(JNIEnv *jenv):
|
__DIRECTOR__(JNIEnv *jenv):
|
||||||
__jvm((JavaVM *) NULL),
|
__jvm((JavaVM *) NULL),
|
||||||
__self(NULL)
|
__self(NULL)
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%insert(runtime) %{
|
%insert(runtime) %{
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
%insert(runtime) %{
|
%insert(runtime) %{
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -61,11 +60,6 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* the default constructor should not be called */
|
|
||||||
__DIRECTOR__() {
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wrap a ocaml object, optionally taking ownership */
|
/* wrap a ocaml object, optionally taking ownership */
|
||||||
__DIRECTOR__(CAML_VALUE self, int disown): _self(self), _disown(disown) {
|
__DIRECTOR__(CAML_VALUE self, int disown): _self(self), _disown(disown) {
|
||||||
register_global_root(&_self);
|
register_global_root(&_self);
|
||||||
|
|
@ -125,7 +119,6 @@ public:
|
||||||
/* acquire ownership of the wrapped ocaml object (the sense of "disown"
|
/* acquire ownership of the wrapped ocaml object (the sense of "disown"
|
||||||
* is from ocaml) */
|
* is from ocaml) */
|
||||||
void __disown() const {
|
void __disown() const {
|
||||||
assert(_self);
|
|
||||||
if (!_disown) {
|
if (!_disown) {
|
||||||
_disown=1;
|
_disown=1;
|
||||||
callback(*caml_named_value("caml_obj_disown"),_self);
|
callback(*caml_named_value("caml_obj_disown"),_self);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ private:
|
||||||
|
|
||||||
/* decrement the reference count of the wrapped python object */
|
/* decrement the reference count of the wrapped python object */
|
||||||
void __decref() const {
|
void __decref() const {
|
||||||
assert(_self);
|
|
||||||
if (_disown) {
|
if (_disown) {
|
||||||
Py_DECREF(_self);
|
Py_DECREF(_self);
|
||||||
}
|
}
|
||||||
|
|
@ -93,11 +92,6 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* the default constructor should not be called */
|
|
||||||
__DIRECTOR__() {
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wrap a python object, optionally taking ownership */
|
/* wrap a python object, optionally taking ownership */
|
||||||
__DIRECTOR__(PyObject* self, int disown): _self(self), _disown(disown) {
|
__DIRECTOR__(PyObject* self, int disown): _self(self), _disown(disown) {
|
||||||
__incref();
|
__incref();
|
||||||
|
|
@ -155,7 +149,6 @@ public:
|
||||||
/* acquire ownership of the wrapped python object (the sense of "disown"
|
/* acquire ownership of the wrapped python object (the sense of "disown"
|
||||||
* is from python) */
|
* is from python) */
|
||||||
void __disown() const {
|
void __disown() const {
|
||||||
assert(_self);
|
|
||||||
if (!_disown) {
|
if (!_disown) {
|
||||||
_disown=1;
|
_disown=1;
|
||||||
__incref();
|
__incref();
|
||||||
|
|
@ -164,7 +157,6 @@ public:
|
||||||
|
|
||||||
/* increase the reference count of the wrapped python object */
|
/* increase the reference count of the wrapped python object */
|
||||||
void __incref() const {
|
void __incref() const {
|
||||||
assert(_self);
|
|
||||||
if (_disown) {
|
if (_disown) {
|
||||||
Py_INCREF(_self);
|
Py_INCREF(_self);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,6 @@
|
||||||
} else {
|
} else {
|
||||||
$input = proxy->__get_self();
|
$input = proxy->__get_self();
|
||||||
}
|
}
|
||||||
assert($input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(inv) SWIGTYPE * {
|
%typemap(inv) SWIGTYPE * {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct swig_body_args
|
struct swig_body_args
|
||||||
|
|
@ -99,11 +98,6 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* the default constructor should not be called */
|
|
||||||
__DIRECTOR__() {
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wrap a Ruby object, optionally taking ownership */
|
/* wrap a Ruby object, optionally taking ownership */
|
||||||
__DIRECTOR__(VALUE self, bool disown) : _self(self), _disown(disown) {
|
__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"
|
/* acquire ownership of the wrapped Ruby object (the sense of "disown"
|
||||||
* is from Ruby) */
|
* is from Ruby) */
|
||||||
void __disown() const {
|
void __disown() const {
|
||||||
assert(_self);
|
|
||||||
if (!_disown) {
|
if (!_disown) {
|
||||||
_disown = true;
|
_disown = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,6 @@
|
||||||
} else {
|
} else {
|
||||||
$input = proxy->__get_self();
|
$input = proxy->__get_self();
|
||||||
}
|
}
|
||||||
assert($input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%typemap(inv) SWIGTYPE * {
|
%typemap(inv) SWIGTYPE * {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue