Commit b17ab6e3 authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

ENH: Added XdmfTopologyType to XdmfTopology to handle element types and...

ENH: Added XdmfTopologyType to XdmfTopology to handle element types and associated const data like nodesPerElement and name.  This resembles "Replace subclass with fields" implementation in Refactoring and does a nice job encapsulating element type data in an enum like way avoiding unneccesary subclassing.
parent f0246ede
...@@ -7,28 +7,32 @@ set(BUILD_SHARED_LIBS true) ...@@ -7,28 +7,32 @@ set(BUILD_SHARED_LIBS true)
find_package(Boost REQUIRED) find_package(Boost REQUIRED)
if(Boost_FOUND) if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS})
message(${Boost_INCLUDE_DIRS}) message(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND) endif(Boost_FOUND)
find_package(PythonLibs REQUIRED) find_package(PythonLibs REQUIRED)
if(PYTHONLIBS_FOUND) if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS}) include_directories(${PYTHON_INCLUDE_DIRS})
endif(PYTHONLIBS_FOUND) endif(PYTHONLIBS_FOUND)
set(XdmfSources set(XdmfSources
XdmfGeometry XdmfGeometry
XdmfGrid XdmfGrid
XdmfObject XdmfObject
XdmfTopology XdmfTopology
) )
add_library(Xdmf ${XdmfSources}) add_library(Xdmf ${XdmfSources})
add_library(_Xdmf MODULE XdmfPython) #add_library(_Xdmf MODULE XdmfPython)
set_target_properties(_Xdmf PROPERTIES PREFIX "") #set_target_properties(_Xdmf PROPERTIES PREFIX "")
target_link_libraries(_Xdmf Xdmf) #target_link_libraries(_Xdmf Xdmf)
configure_file(Xdmf.py Xdmf.py COPYONLY) #configure_file(Xdmf.py Xdmf.py COPYONLY)
add_executable(XdmfTest test.cpp) option(BUILD_TESTING OFF)
target_link_libraries(XdmfTest Xdmf) if(BUILD_TESTING)
add_subdirectory(tests)
add_executable(XdmfTest test.cpp)
target_link_libraries(XdmfTest Xdmf)
endif(BUILD_TESTING)
\ No newline at end of file
/*
XdmfPython.cpp:
swig -v -c++ -make_default -python -shadow -I/share/kleiter/boost-1.41.0-install/include -o XdmfPython.cpp Xdmf.i
*/
%include std_string.i
%include std_vector.i
namespace boost {
template<class T> class shared_ptr
{
public:
T * operator-> () const;
};
}
%template(XdmfGridPtr) boost::shared_ptr<XdmfGrid>;
%module Xdmf
%{
#include <XdmfGeometry.hpp>
#include <XdmfGrid.hpp>
#include <XdmfObject.hpp>
#include <XdmfTopology.hpp>
%}
%include XdmfObject.hpp
%include XdmfGeometry.hpp
%include XdmfGrid.hpp
%include XdmfObject.hpp
%include XdmfTopology.hpp
# This file was automatically generated by SWIG (http://www.swig.org). # This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.37 # Version 1.3.40
# #
# Do not make changes to this file unless you know what you are doing--modify # Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead. # the SWIG interface file instead.
...@@ -10,12 +10,18 @@ if version_info >= (2,6,0): ...@@ -10,12 +10,18 @@ if version_info >= (2,6,0):
def swig_import_helper(): def swig_import_helper():
from os.path import dirname from os.path import dirname
import imp import imp
fp = None
try: try:
fp, pathname, description = imp.find_module('_Xdmf', [dirname(__file__)]) fp, pathname, description = imp.find_module('_Xdmf', [dirname(__file__)])
_mod = imp.load_module('_Xdmf', fp, pathname, description) except ImportError:
finally: import _Xdmf
if fp is not None: fp.close() return _Xdmf
return _mod if fp is not None:
try:
_mod = imp.load_module('_Xdmf', fp, pathname, description)
finally:
fp.close()
return _mod
_Xdmf = swig_import_helper() _Xdmf = swig_import_helper()
del swig_import_helper del swig_import_helper
else: else:
...@@ -65,7 +71,7 @@ class SwigPyIterator(_object): ...@@ -65,7 +71,7 @@ class SwigPyIterator(_object):
__setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value) __setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value)
__swig_getmethods__ = {} __swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name) __getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_destroy__ = _Xdmf.delete_SwigPyIterator __swig_destroy__ = _Xdmf.delete_SwigPyIterator
__del__ = lambda self : None; __del__ = lambda self : None;
...@@ -161,6 +167,9 @@ class XdmfTopologyPtr(_object): ...@@ -161,6 +167,9 @@ class XdmfTopologyPtr(_object):
__swig_destroy__ = _Xdmf.delete_XdmfTopologyPtr __swig_destroy__ = _Xdmf.delete_XdmfTopologyPtr
__del__ = lambda self : None; __del__ = lambda self : None;
def New(self): return _Xdmf.XdmfTopologyPtr_New(self) def New(self): return _Xdmf.XdmfTopologyPtr_New(self)
def getTopologyType(self): return _Xdmf.XdmfTopologyPtr_getTopologyType(self)
def setTopologyType(self, *args): return _Xdmf.XdmfTopologyPtr_setTopologyType(self, *args)
def getTopologyTypeAsString(self): return _Xdmf.XdmfTopologyPtr_getTopologyTypeAsString(self)
def printSelf(self): return _Xdmf.XdmfTopologyPtr_printSelf(self) def printSelf(self): return _Xdmf.XdmfTopologyPtr_printSelf(self)
XdmfTopologyPtr_swigregister = _Xdmf.XdmfTopologyPtr_swigregister XdmfTopologyPtr_swigregister = _Xdmf.XdmfTopologyPtr_swigregister
XdmfTopologyPtr_swigregister(XdmfTopologyPtr) XdmfTopologyPtr_swigregister(XdmfTopologyPtr)
...@@ -224,6 +233,30 @@ def XdmfGrid_New(): ...@@ -224,6 +233,30 @@ def XdmfGrid_New():
return _Xdmf.XdmfGrid_New() return _Xdmf.XdmfGrid_New()
XdmfGrid_New = _Xdmf.XdmfGrid_New XdmfGrid_New = _Xdmf.XdmfGrid_New
XDMF_NOTOPOLOGY = _Xdmf.XDMF_NOTOPOLOGY
XDMF_POLYVERTEX = _Xdmf.XDMF_POLYVERTEX
XDMF_POLYLINE = _Xdmf.XDMF_POLYLINE
XDMF_POLYGON = _Xdmf.XDMF_POLYGON
XDMF_TRI = _Xdmf.XDMF_TRI
XDMF_QUAD = _Xdmf.XDMF_QUAD
XDMF_TET = _Xdmf.XDMF_TET
XDMF_PYRAMID = _Xdmf.XDMF_PYRAMID
XDMF_WEDGE = _Xdmf.XDMF_WEDGE
XDMF_HEX = _Xdmf.XDMF_HEX
XDMF_EDGE_3 = _Xdmf.XDMF_EDGE_3
XDMF_TRI_6 = _Xdmf.XDMF_TRI_6
XDMF_QUAD_8 = _Xdmf.XDMF_QUAD_8
XDMF_TET_10 = _Xdmf.XDMF_TET_10
XDMF_PYRAMID_13 = _Xdmf.XDMF_PYRAMID_13
XDMF_WEDGE_15 = _Xdmf.XDMF_WEDGE_15
XDMF_HEX_20 = _Xdmf.XDMF_HEX_20
XDMF_MIXED = _Xdmf.XDMF_MIXED
XDMF_2DSMESH = _Xdmf.XDMF_2DSMESH
XDMF_2DRECTMESH = _Xdmf.XDMF_2DRECTMESH
XDMF_2DCORECTMESH = _Xdmf.XDMF_2DCORECTMESH
XDMF_3DSMESH = _Xdmf.XDMF_3DSMESH
XDMF_3DRECTMESH = _Xdmf.XDMF_3DRECTMESH
XDMF_3DCORECTMESH = _Xdmf.XDMF_3DCORECTMESH
class XdmfTopology(XdmfObject): class XdmfTopology(XdmfObject):
__swig_setmethods__ = {} __swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{})) for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
...@@ -235,6 +268,9 @@ class XdmfTopology(XdmfObject): ...@@ -235,6 +268,9 @@ class XdmfTopology(XdmfObject):
__repr__ = _swig_repr __repr__ = _swig_repr
__swig_getmethods__["New"] = lambda x: _Xdmf.XdmfTopology_New __swig_getmethods__["New"] = lambda x: _Xdmf.XdmfTopology_New
if _newclass:New = staticmethod(_Xdmf.XdmfTopology_New) if _newclass:New = staticmethod(_Xdmf.XdmfTopology_New)
def getTopologyType(self): return _Xdmf.XdmfTopology_getTopologyType(self)
def setTopologyType(self, *args): return _Xdmf.XdmfTopology_setTopologyType(self, *args)
def getTopologyTypeAsString(self): return _Xdmf.XdmfTopology_getTopologyTypeAsString(self)
def printSelf(self): return _Xdmf.XdmfTopology_printSelf(self) def printSelf(self): return _Xdmf.XdmfTopology_printSelf(self)
XdmfTopology_swigregister = _Xdmf.XdmfTopology_swigregister XdmfTopology_swigregister = _Xdmf.XdmfTopology_swigregister
XdmfTopology_swigregister(XdmfTopology) XdmfTopology_swigregister(XdmfTopology)
......
...@@ -17,7 +17,7 @@ XdmfGeometry::~XdmfGeometry() ...@@ -17,7 +17,7 @@ XdmfGeometry::~XdmfGeometry()
std::cout << "Deleted Geometry " << this << std::endl; std::cout << "Deleted Geometry " << this << std::endl;
} }
std::string XdmfGeometry::printSelf() const const std::string XdmfGeometry::printSelf() const
{ {
return "XdmfGeometry"; return "XdmfGeometry";
} }
...@@ -15,7 +15,7 @@ class XdmfGeometry : public XdmfObject { ...@@ -15,7 +15,7 @@ class XdmfGeometry : public XdmfObject {
public: public:
XdmfNewMacro(XdmfGeometry); XdmfNewMacro(XdmfGeometry);
virtual std::string printSelf() const; virtual const std::string printSelf() const;
protected: protected:
......
...@@ -21,7 +21,7 @@ XdmfGrid::~XdmfGrid() ...@@ -21,7 +21,7 @@ XdmfGrid::~XdmfGrid()
std::cout << "Deleted Grid " << this << std::endl; std::cout << "Deleted Grid " << this << std::endl;
} }
std::string XdmfGrid::printSelf() const const std::string XdmfGrid::printSelf() const
{ {
return "XdmfGrid containing a " + mGeometry->printSelf() + " and a " + mTopology->printSelf(); return "XdmfGrid containing a " + mGeometry->printSelf() + " and a " + mTopology->printSelf();
} }
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
// Set the XdmfTopology for this grid // Set the XdmfTopology for this grid
XdmfSetValueMacro(Topology, boost::shared_ptr<XdmfTopology>); XdmfSetValueMacro(Topology, boost::shared_ptr<XdmfTopology>);
virtual std::string printSelf() const; virtual const std::string printSelf() const;
protected: protected:
......
...@@ -17,7 +17,7 @@ XdmfObject::~XdmfObject() ...@@ -17,7 +17,7 @@ XdmfObject::~XdmfObject()
} }
std::string XdmfObject::printSelf() const const std::string XdmfObject::printSelf() const
{ {
return "XdmfObject"; return "XdmfObject";
} }
......
...@@ -20,14 +20,14 @@ static boost::shared_ptr<type> New() \ ...@@ -20,14 +20,14 @@ static boost::shared_ptr<type> New() \
return p; \ return p; \
} }
#define XdmfGetValueMacro(var,type) \ #define XdmfGetValueMacro(var, type) \
type get##var () \ type get##var () \
{ \ { \
return ( this->m##var ); \ return ( this->m##var ); \
} }
#define XdmfSetValueMacro(var,type) \ #define XdmfSetValueMacro(var,type) \
void set##var (type _arg) \ void set##var (const type _arg) \
{ \ { \
this->m##var = _arg; \ this->m##var = _arg; \
} }
...@@ -37,7 +37,7 @@ class XdmfObject { ...@@ -37,7 +37,7 @@ class XdmfObject {
public: public:
XdmfNewMacro(XdmfObject); XdmfNewMacro(XdmfObject);
virtual std::string printSelf() const; virtual const std::string printSelf() const;
protected: protected:
......
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org). * This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.37 * Version 1.3.40
* *
* This file is not intended to be easily readable and contains a number of * This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make * coding conventions designed to improve portability and efficiency. Do not make
...@@ -749,7 +749,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { ...@@ -749,7 +749,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
/* Compatibility marcos for Python 3 */ /* Compatibility macros for Python 3 */
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type) #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
...@@ -772,17 +772,35 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) { ...@@ -772,17 +772,35 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
# define SWIG_Python_str_FromFormat PyString_FromFormat # define SWIG_Python_str_FromFormat PyString_FromFormat
#endif #endif
/* Warning: This function will allocate a new string in Python 3,
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
*/
SWIGINTERN char* SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str) SWIG_Python_str_AsChar(PyObject *str)
{ {
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
char *cstr;
char *newstr;
Py_ssize_t len;
str = PyUnicode_AsUTF8String(str); str = PyUnicode_AsUTF8String(str);
return PyBytes_AsString(str); PyBytes_AsStringAndSize(str, &cstr, &len);
newstr = (char *) malloc(len+1);
memcpy(newstr, cstr, len+1);
Py_XDECREF(str);
return newstr;
#else #else
return PyString_AsString(str); return PyString_AsString(str);
#endif #endif
} }
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
#else
# define SWIG_Python_str_DelForPy3(x)
#endif
SWIGINTERN PyObject* SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char *c) SWIG_Python_str_FromChar(const char *c)
{ {
...@@ -937,11 +955,13 @@ SWIG_Python_AddErrorMsg(const char* mesg) ...@@ -937,11 +955,13 @@ SWIG_Python_AddErrorMsg(const char* mesg)
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback); if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
if (value) { if (value) {
char *tmp;
PyObject *old_str = PyObject_Str(value); PyObject *old_str = PyObject_Str(value);
PyErr_Clear(); PyErr_Clear();
Py_XINCREF(type); Py_XINCREF(type);
PyErr_Format(type, "%s %s", SWIG_Python_str_AsChar(old_str), mesg); PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str); Py_DECREF(old_str);
Py_DECREF(value); Py_DECREF(value);
} else { } else {
...@@ -1452,9 +1472,7 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args) ...@@ -1452,9 +1472,7 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
#endif #endif
{ {
const char *name = SWIG_TypePrettyName(v->ty); const char *name = SWIG_TypePrettyName(v->ty);
PyObject *hex = SwigPyObject_hex(v); PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, v);
PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, hex);
Py_DECREF(hex);
if (v->next) { if (v->next) {
#ifdef METH_NOARGS #ifdef METH_NOARGS
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next); PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
...@@ -1476,13 +1494,16 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args) ...@@ -1476,13 +1494,16 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
SWIGRUNTIME int SWIGRUNTIME int
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
{ {
char *str;
#ifdef METH_NOARGS #ifdef METH_NOARGS
PyObject *repr = SwigPyObject_repr(v); PyObject *repr = SwigPyObject_repr(v);
#else #else
PyObject *repr = SwigPyObject_repr(v, NULL); PyObject *repr = SwigPyObject_repr(v, NULL);
#endif #endif
if (repr) { if (repr) {
fputs(SWIG_Python_str_AsChar(repr), fp); str = SWIG_Python_str_AsChar(repr);
fputs(str, fp);
SWIG_Python_str_DelForPy3(str);
Py_DECREF(repr); Py_DECREF(repr);
return 0; return 0;
} else { } else {
...@@ -1506,7 +1527,7 @@ SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) ...@@ -1506,7 +1527,7 @@ SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
return (i < j) ? -1 : ((i > j) ? 1 : 0); return (i < j) ? -1 : ((i > j) ? 1 : 0);
} }
/* Added for Python 3.x, whould it also useful for Python 2.x? */ /* Added for Python 3.x, would it also be useful for Python 2.x? */
SWIGRUNTIME PyObject* SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
{ {
...@@ -1554,7 +1575,7 @@ SwigPyObject_dealloc(PyObject *v) ...@@ -1554,7 +1575,7 @@ SwigPyObject_dealloc(PyObject *v)
/* destroy is always a VARARGS method */ /* destroy is always a VARARGS method */
PyObject *res; PyObject *res;
if (data->delargs) { if (data->delargs) {
/* we need to create a temporal object to carry the destroy operation */ /* we need to create a temporary object to carry the destroy operation */
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0); PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
res = SWIG_Python_CallFunctor(destroy, tmp); res = SWIG_Python_CallFunctor(destroy, tmp);
Py_DECREF(tmp); Py_DECREF(tmp);
...@@ -1729,7 +1750,11 @@ _PySwigObject_type(void) { ...@@ -1729,7 +1750,11 @@ _PySwigObject_type(void) {
0, /*nb_coerce*/ 0, /*nb_coerce*/
#endif #endif
(unaryfunc)SwigPyObject_long, /*nb_int*/ (unaryfunc)SwigPyObject_long, /*nb_int*/
#if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_long, /*nb_long*/ (unaryfunc)SwigPyObject_long, /*nb_long*/
#else
0, /*nb_reserved*/
#endif
(unaryfunc)0, /*nb_float*/ (unaryfunc)0, /*nb_float*/
#if PY_VERSION_HEX < 0x03000000 #if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_oct, /*nb_oct*/ (unaryfunc)SwigPyObject_oct, /*nb_oct*/
...@@ -1751,7 +1776,7 @@ _PySwigObject_type(void) { ...@@ -1751,7 +1776,7 @@ _PySwigObject_type(void) {
if (!type_init) { if (!type_init) {
const PyTypeObject tmp const PyTypeObject tmp
= { = {
/* PyOjbect header changed in Python 3 */ /* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(&PyType_Type, 0) PyVarObject_HEAD_INIT(&PyType_Type, 0)
#else #else
...@@ -1769,7 +1794,11 @@ _PySwigObject_type(void) { ...@@ -1769,7 +1794,11 @@ _PySwigObject_type(void) {
(getattrfunc)0, /* tp_getattr */ (getattrfunc)0, /* tp_getattr */
#endif #endif
(setattrfunc)0, /* tp_setattr */ (setattrfunc)0, /* tp_setattr */
(cmpfunc)SwigPyObject_compare, /* tp_compare */ #if PY_VERSION_HEX >= 0x03000000
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
#else
(cmpfunc)SwigPyObject_compare, /* tp_compare */
#endif
(reprfunc)SwigPyObject_repr, /* tp_repr */ (reprfunc)SwigPyObject_repr, /* tp_repr */
&SwigPyObject_as_number, /* tp_as_number */ &SwigPyObject_as_number, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
...@@ -1816,7 +1845,7 @@ _PySwigObject_type(void) { ...@@ -1816,7 +1845,7 @@ _PySwigObject_type(void) {
#endif #endif
}; };
swigpyobject_type = tmp; swigpyobject_type = tmp;
/* for Python 3 we already assigned the ob_type in PyVarObject_HEAD_INIT() */ /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
#if PY_VERSION_HEX < 0x03000000 #if PY_VERSION_HEX < 0x03000000
swigpyobject_type.ob_type = &PyType_Type; swigpyobject_type.ob_type = &PyType_Type;
#endif #endif
...@@ -1940,14 +1969,18 @@ _PySwigPacked_type(void) { ...@@ -1940,14 +1969,18 @@ _PySwigPacked_type(void) {
(printfunc)SwigPyPacked_print, /* tp_print */ (printfunc)SwigPyPacked_print, /* tp_print */
(getattrfunc)0, /* tp_getattr */ (getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */ (setattrfunc)0, /* tp_setattr */
(cmpfunc)SwigPyPacked_compare, /* tp_compare */ #if PY_VERSION_HEX>=0x03000000
(reprfunc)SwigPyPacked_repr, /* tp_repr */ 0, /* tp_reserved in 3.0.1 */
0, /* tp_as_number */ #else
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
#endif
(reprfunc)SwigPyPacked_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */ 0, /* tp_as_sequence */
0, /* tp_as_mapping */ 0, /* tp_as_mapping */
(hashfunc)0, /* tp_hash */ (hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */ (ternaryfunc)0, /* tp_call */
(reprfunc)SwigPyPacked_str, /* tp_str */ (reprfunc)SwigPyPacked_str, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */ PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */ 0, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
...@@ -2219,10 +2252,10 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) { ...@@ -2219,10 +2252,10 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
/* here we get the method pointer for callbacks */ /* here we get the method pointer for callbacks */
const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0; const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
if (desc) { if (desc)
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0; desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
if (!desc) return SWIG_ERROR; if (!desc)
} return SWIG_ERROR;
if (ty) { if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty); swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
if (tc) { if (tc) {
...@@ -2260,7 +2293,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t ...@@ -2260,7 +2293,7 @@ SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *t
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
/* /*
Create a new instance object, whitout calling __init__, and set the Create a new instance object, without calling __init__, and set the
'this' attribute. 'this' attribute.
*/ */
...@@ -2291,7 +2324,6 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) ...@@ -2291,7 +2324,6 @@ SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
} else { } else {
#if PY_VERSION_HEX >= 0x03000000 #if PY_VERSION_HEX >= 0x03000000
inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None); inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
Py_INCREF(data->newargs);
PyObject_SetAttr(inst, SWIG_This(), swig_this); PyObject_SetAttr(inst, SWIG_This(), swig_this);
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
#else #else
...@@ -2532,21 +2564,23 @@ SWIG_Python_TypeQuery(const char *type) ...@@ -2532,21 +2564,23 @@ SWIG_Python_TypeQuery(const char *type)
SWIGRUNTIME int SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char* mesg, int infront) SWIG_Python_AddErrMesg(const char* mesg, int infront)
{ {
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
PyObject *type = 0; PyObject *type = 0;
PyObject *value = 0; PyObject *value = 0;