|
RE: SWIG-PERL-Vector of pointers: msg#00104programming.swig
I do instantiate the template using the %template directive. I written a small test class %module SbsdSLI %include "std_vector.i" typedef struct Abcd { int i; short j; } Abcd; %template(Abcd_vector) std::vector<Abcd>; class Test { public: void disable( std::vector<Abcd_vector>& abcdVector ); }; SWIG generated code only has 3 parameters ( unlike the int vector which has 4) static swig_type_info _swigt__p_Abcd_vector[] = {{"_p_Abcd_vector", 0, "Abcd_vector &", 0},{"_p_Abcd_vector"},{0}}; I assume you support Vector of Structs right? Thanks, -snajay -----Original Message----- From: Luigi Ballabio [mailto:luigi.ballabio@xxxxxxxxxxxxx] Sent: Monday, November 17, 2003 9:30 AM To: Nair, Sanjay S Cc: luigi.ballabio@xxxxxxxxxxxxx; swig@xxxxxxxxxxxxxxx Subject: Re: [Swig] SWIG-PERL-Vector of pointers On 2003.11.17 17:49, "Nair, Sanjay S" wrote: > I have the following swig code > > %module SbsdSLI > > %include "std_vector.i" > > %template (Int_vector) std::vector<int>; > typedef std::vector<int> Int_vector; > > namespace SBSD { > > struct BpDataStruct_SLI{ > long type; > }; > typedef std::vector<BpDataStruct_SLI> BpDataStruct_SLI_vector; > > class ItpBreakpointSLIProxy { > > int ReadBp ( const Int_vector& vReadData, > BpDataStruct_SLI_vector& vReadData ); > }; > }; Well, you do have to instantiate the template. The directive %template(BpDataStruct_SLI_vector) std::vector<SBSD::BpDataStruct_SLI> should do the trick. If that fails, try namespace SBSD { %template(BpDataStruct_SLI_vector) std::vector<BpDataStruct_SLI> } > Also, do you support Vector of pointers in SWIG? I'll have to check that. Later, Luigi _______________________________________________ Swig maillist - Swig@xxxxxxxxxxxxxxx http://mailman.cs.uchicago.edu/mailman/listinfo/swig |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: SWIG-PERL-Vector of pointers: 00104, Luigi Ballabio |
|---|---|
| Next by Date: | Re: %include: 00104, Scott Michel |
| Previous by Thread: | Re: SWIG-PERL-Vector of pointersi: 00104, Luigi Ballabio |
| Next by Thread: | Re: SWIG-PERL-Vector of pointers: 00104, Luigi Ballabio |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |