1 %module smart_pointer_templatevariables 2 3 %inline %{ 4 template <class _CharT> 5 struct basic_string { 6 int npos; 7 }; 8 9 template<class T> 10 struct Ptr { ptrPtr11 Ptr(T *p = 0) : ptr(p) {} ~PtrPtr12 ~Ptr() { delete ptr; } 13 T *operator->() const { return ptr; } 14 private: 15 T *ptr; 16 }; 17 18 template <typename KernelPixelT> 19 struct DiffImContainer { 20 int id; 21 // static members seem to be can of worms. Note that SWIG wraps them as non-static members. Why? 22 // Note CHANGES entry 10/14/2003. Static const variables are not wrapped as constants but as a read only variable. Why? 23 // static short xyz; 24 // static const short constvar = 555; 25 }; 26 //template<typename KernelPixelT> short DiffImContainer<KernelPixelT>::xyz = 0; 27 create(int id,short xyz)28DiffImContainer<double>* create(int id, short xyz) { 29 DiffImContainer<double> *d = new DiffImContainer<double>(); 30 d->id = id; 31 // DiffImContainer<double>::xyz = xyz; 32 return d; 33 } 34 %} 35 36 %template(BasicString) basic_string<char>; 37 %template(DiffImContainer_D) DiffImContainer<double>; 38 %template(DiffImContainerPtr_D) Ptr<DiffImContainer<double> >; 39 40