logo       

Re: Problems with %rename (const): msg#00157

programming.swig

Subject: Re: Problems with %rename (const)

Well, I have been looking more into it. And I was wrong on one point. It
does generate the xxxConst methods. BUT it generates two
non-const-methods in the JavaClass.

[snip:java]
71
72 public aabbox3df getBoundingBoxConst() {
73 return new
aabbox3df(JirrJNI.SMeshBuffer_getBoundingBoxConst(swigCPtr), false);
74 }
75
76 public aabbox3df getBoundingBox() {
77 return new
aabbox3df(JirrJNI.SMeshBuffer_getBoundingBox(swigCPtr), false);
78 }
...
119 public aabbox3df getBoundingBox() {
120 long cPtr = JirrJNI.get_SMeshBuffer_BoundingBox(swigCPtr);
121 return (cPtr == 0) ? null : new aabbox3df(cPtr, false);
122 }
123
[/snip:java]


These methods are generated from the Header-file of the IMeshBuffer
(iirlicht 3D engine). Here are all the methods (that have stuff to do
with getBoundingBox).

[snip:c++]
14 namespace irr
15 {
16 namespace scene
17 {
18 //! Struct for holding a mesh with a single material
19 /** SMeshBuffer is a simple implementation of a MeshBuffer. */
20 class IMeshBuffer : public IUnknown
21 {
22 public:
23
24 //! destructor
25 virtual ~IMeshBuffer() {};
...
56 //! returns an axis aligned bounding box
57 virtual const core::aabbox3d<f32>& getBoundingBox() const =
0;
58
59 //! returns an axis aligned bounding box
60 virtual core::aabbox3d<f32>& getBoundingBox() = 0;
61 };

[/snip:c++]

Ok, I see it's inheriting from IUnknown, and I looked into this class
(see if it had getBoundingBox-methods as well) it didn't. Nor did it
inherit from other classes.

I am currently trying to debug SWIG, figure out where these methods come
from, and maybe figuring out what is wrong. But its not my project, and
I spend a lot of time just figuring out how the app works :)

Any help would be appreciated

On Thu, 2004-09-23 at 22:39, William S Fulton wrote:
> Emanuel Greisen wrote:
> > I am currently trying to do a rename since I have some overloaded C++
> > functions.
> >
> > Here is my renames:
> >
> > ...
> > 130 // RENAMING OF CONST-VARIANTS
> > 131 %rename(getMaterialConst) *::getMaterial() const;
> > 132 %rename(getBoundingBoxConst) getBoundingBox() const;
> > 133 //%ignore getBoundingBox() const;
> > 134 %rename(getVerticesConst) *::getVertices() const;
> > 135 %rename(getIndicesConst) *::getIndices() const;
> > 136 %rename(getLastConst) *::getLast() const;
> > ...
> >
> > I am not getting warnings about ignored methods (did before I inserted
> > the %rename lines)
> >
> > But.... I get java compile errors about the methods being duplicated.
> >
> > ...
> > src/java/net/sf/jirr/SMeshBuffer.java:92: getMaterial() is already
> > defined in net.sf.jirr.SMeshBuffer
> > public SMaterial getMaterial() {
> > ^
> > src/java/net/sf/jirr/SMeshBuffer.java:101: getVertices() is already
> > defined in net.sf.jirr.SMeshBuffer
> > public SWIGTYPE_p_irr__core__arrayTirr__video__S3DVertex_t
> > getVertices() {
> > ^
> > src/java/net/sf/jirr/SMeshBuffer.java:110: getIndices() is already
> > defined in net.sf.jirr.SMeshBuffer
> > public SWIGTYPE_p_irr__core__arrayTunsigned_short_t getIndices() {
> > ^
> > src/java/net/sf/jirr/SMeshBuffer.java:119: getBoundingBox() is already
> > defined in net.sf.jirr.SMeshBuffer
> > public aabbox3df getBoundingBox() {
> > ^
> > src/java/net/sf/jirr/ILogger.java:56:
> > log(java.lang.String,java.lang.String,net.sf.jirr.ELOG_LEVEL) is already
> > defined in net.sf.jirr.ILogger
> > public void log(String text, String hint, ELOG_LEVEL ll) {
> > ^
> > src/java/net/sf/jirr/ILogger.java:60:
> > log(java.lang.String,net.sf.jirr.ELOG_LEVEL) is already defined in
> > net.sf.jirr.ILogger
> > public void log(String text, ELOG_LEVEL ll) {
> > ^
> > src/java/net/sf/jirr/SMesh.java:82: getBoundingBox() is already defined
> > in net.sf.jirr.SMesh
> > public aabbox3df getBoundingBox() {
> > ^
> > src/java/net/sf/jirr/SMeshBufferLightMap.java:92: getMaterial() is
> > already defined in net.sf.jirr.SMeshBufferLightMap
> > public SMaterial getMaterial() {
> > ^
> > src/java/net/sf/jirr/SMeshBufferLightMap.java:101: getVertices() is
> > already defined in net.sf.jirr.SMeshBufferLightMap
> > public SWIGTYPE_p_irr__core__arrayTirr__video__S3DVertex2TCoords_t
> > getVertices() {
> > ^
> > src/java/net/sf/jirr/SMeshBufferLightMap.java:110: getIndices() is
> > already defined in net.sf.jirr.SMeshBufferLightMap
> > public SWIGTYPE_p_irr__core__arrayTunsigned_short_t getIndices() {
> > ^
> > src/java/net/sf/jirr/SMeshBufferLightMap.java:119: getBoundingBox() is
> > already defined in net.sf.jirr.SMeshBufferLightMap
> > public aabbox3df getBoundingBox() {
> > ...
> >
> >
> > Just for reference, here is some of the C++ source I am trying to SWIG !
> >
> >
> > ...
> > //! returns pointer to vertex data. The data is a array of vertices. Which
> > vertex
> > //! type is used can be determinated with getVertexType().
> > virtual const void* getVertices() const = 0;
> >
> > //! returns pointer to vertex data. The data is a array of vertices. Which
> > vertex
> > //! type is used can be determinated with getVertexType().
> > virtual void* getVertices() = 0;
> > ...
> >
> Strange. Are you sure you are compiling the last Java files that SWIG
> generated?
> Break it into a small example for us to look at if it really is misbehaving.
> BTW
> the warning messages will disappear once you've renamed the offending method
> as
> it will no longer be ignored but generated under the new name.
>
> William
--
./Emanuel

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise