1 %module valuewrapper_opaque
7 %feature("valuewrapper") C;
11 template<typename T> class TemplateClass {
13 TemplateClass<T>(T a) {}
29 * Hint swig that the Opaque type B don't need the value wrapper.
30 * This hint is only necessary in very very special cases.
32 %feature("novaluewrapper") B;
36 * Force swig to use the value wrapper, even when the class
37 * has a default constructor, in case you want to save a
38 * instance construction.
41 %feature("valuewrapper") D;
45 %feature("valuewrapper") A;
48 %feature("valuewrapper") TemplateClass<A>;
49 %feature("valuewrapper") TemplateClass<C>;
50 template<class T> class TemplateClass;
52 %feature("valuewrapper") BB;
68 TemplateClass<Klass> getKlass(Klass k) {
69 TemplateClass<Klass> t(k);
74 TemplateClass<A> getA(A a) {
75 TemplateClass<A> t(a);
80 TemplateClass<B> getA(B b) {
81 TemplateClass<B> t(b);
86 TemplateClass<C> getC(C a) {
87 TemplateClass<C> t(a);
92 TemplateClass<int> getInt(int a) {
93 TemplateClass<int> t(a);
101 Klass sgetKlass(Klass a) {
111 auto_ptr<A> getPtrA(auto_ptr<A> a) {
125 %template() auto_ptr<A>;
128 /***** Another strange case, member var + opaque, bug #901706 ******/
134 BB(int aa) { this->a = aa; };
182 %feature("novaluewrapper") Foobar;
196 #if defined(SWIGPYTHON)
199 This case can't be fixed by using the valuewrapper feature and the
200 old mechanismbut it works fine with the new mechanism
205 // Template primitive type, only visible in C++
211 // This case is disabled by now
212 // Param(T v): val(v) {}
214 Param(T v = T()): val(v) {}
216 operator T() const { return val; }
222 Several languages have 'not 100% safe' typemaps,
223 where the following %applies don't work.
225 %apply int { Param<int> };
226 %apply const int& { const Param<int>& };
228 %apply double { Param<double> };
229 %apply const double& { const Param<double>& };
234 T getv(const Param<T>& p)
240 Param<T> getp(const T& v)
247 %template(getv_i) getv<int>;
248 %template(getp_i) getp<int>;
250 %template(getv_d) getv<double>;
251 %template(getp_d) getp<double>;