hi,<div><br></div><div>since my last post, i've lot difficult to implement a "simple" binding with sip</div><div><br></div><div>i try to bind the good ilmBase librairy.</div><div>i extract a exemple with error with sip</div>
<div><br></div><div>// ________________________C+++ File ________________________</div><div><div>#ifndef INCLUDED_IMATHVEC_H</div><div>#define INCLUDED_IMATHVEC_H</div><div><br></div><div>namespace Imath {</div><div>template <class T> class Vec2;</div>
<div><br></div><div>template <class T> class Vec2</div><div>{</div><div> public:</div><div><br></div><div> T<span class="Apple-tab-span" style="white-space:pre"> </span>x, y;</div><div><br></div><div> T &<span class="Apple-tab-span" style="white-space:pre"> </span>operator [] (int i);</div>
<div> const T &<span class="Apple-tab-span" style="white-space:pre"> </span>operator [] (int i) const;</div><div><br></div><div> Vec2 (); // no initialization</div><div> explicit Vec2 (T a); // (a a)</div>
<div> Vec2 (T a, T b); // (a b)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div>// Base type -- in templates</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>typedef T<span class="Apple-tab-span" style="white-space:pre"> </span>BaseType;</div>
<div>};</div><div><br></div><div>// Typedefs for convenience</div><div>typedef Vec2 <int> V2i;</div><div>typedef Vec2 <float> V2f;</div><div>typedef Vec2 <double> V2d;</div><div><br></div><div><div>} // namespace Imath</div>
</div><div><br></div><div>#endif</div></div><div><br></div><div><div><div>// ________________________Sip File ________________________</div><div></div></div></div><div><div>%Module KitCG 0</div><div><br></div><div>%UnitPostIncludeCode</div>
<div>namespace Imath {};</div><div>using namespace Imath;</div><div>%End</div><div><br></div><div>template<TYPE></div><div>class Vec2</div><div>{</div><div>%TypeHeaderCode</div><div>#include "ImathVec.h"</div>
<div>%End</div><div> public:</div><div> TYPE<span class="Apple-tab-span" style="white-space:pre"> </span>x;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>TYPE<span class="Apple-tab-span" style="white-space:pre"> </span>y;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>// For info, TYPE <span class="Apple-tab-span" style="white-space:pre"> </span>x,y; or mmore simple float x,y; generate a sip error</div><div><br></div><div>
TYPE &<span class="Apple-tab-span" style="white-space:pre"> </span>operator [] (int i);</div><div> const TYPE &<span class="Apple-tab-span" style="white-space:pre"> </span>operator [] (int i) const;</div>
<div><br></div><div><br></div><div> //-------------</div><div> // Constructors</div><div> //-------------</div><div><br></div><div> Vec2 (); // no initialization</div><div> explicit Vec2 (TYPE a); // (a a)</div>
<div> Vec2 (TYPE a, TYPE b); // (a b)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>// Base type -- in templates</div>
<div> typedef TYPE<span class="Apple-tab-span" style="white-space:pre"> </span>BaseType;</div><div>};</div></div><div><br></div><div><br></div><div>with this code, i've "sip: TYPE is undefined" error message</div>
<div><br></div><div>i read qlist.sip, but i understand is a converion between a QList in C++ and python list</div><div><br></div><div>in my case, i want a v2f, v2d python object</div><div><br></div><div>thx for your help</div>
<div><br></div><div>Kermit</div>