|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Template and method pointeurHello everybody,
I'm trying to wrap several c++ class in c#. I have a problem with a template method. I think I understand the way templates are managed through SWIG but this one is quiet complex: class RegistrationManager { public: template <class T> void registerService(std::string iServiceName, ServiceObject::Status_t (T::*method)(string iPack,string iService, Message& Message), std::string iClassName, std::string iMethodName); ...} I include this decalration in the interface file with the template instanciation required : %template(registerServiceObject) RegistrationManager::registerService<ServiceObject>; ServiceObject is a class previously defined. Here is what swig generates in c# : public void registerServiceObject(string iServiceName, SWIGTYPE_m_T__f_r_q_const__otf__ServicePack_t_r_q_const__otf__Service_t_r_otf__InboundMessage__otf__RunnableObject__Status_t method, string iClassName, string iMethodName) As you can see the second parameter is quiet weird. Do I forgot to do something? |
|
|
Re: Template and method pointeur>-----Original Message-----
>From: swig-user-bounces@... >[mailto:swig-user-bounces@...] On Behalf Of linkjuice >Sent: Thursday, June 05, 2008 12:22 PM >To: swig-user@... >Subject: [Swig-user] Template and method pointeur > > >Hello everybody, > >I'm trying to wrap several c++ class in c#. >I have a problem with a template method. I think I understand the way >templates are managed through SWIG but this one is quiet complex: > >class RegistrationManager >{ > >public: > template <class T> > void registerService(std::string iServiceName, > ServiceObject::Status_t >(T::*method)(string iPack,string iService, >Message& Message), std::string iClassName, std::string iMethodName); >...} > >I include this decalration in the interface file with the template >instanciation required : > >%template(registerServiceObject) >RegistrationManager::registerService<ServiceObject>; > >ServiceObject is a class previously defined. > >Here is what swig generates in c# : > >public void registerServiceObject(string iServiceName, >SWIGTYPE_m_T__f_r_q_const__otf__ServicePack_t_r_q_const__otf__S >ervice_t_r_otf__InboundMessage__otf__RunnableObject__Status_t >method, string iClassName, string iMethodName) > >As you can see the second parameter is quiet weird. Do I forgot to do >something? > This is basically the same problem I'm having. The %template directive generates the wrapper correctly but does not seem to work for method arguments/return values. Daniel. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Template and method pointeurShields, Daniel P.(Technology) wrote:
>> -----Original Message----- >> From: swig-user-bounces@... >> [mailto:swig-user-bounces@...] On Behalf Of linkjuice >> Sent: Thursday, June 05, 2008 12:22 PM >> To: swig-user@... >> Subject: [Swig-user] Template and method pointeur >> >> >> Hello everybody, >> >> I'm trying to wrap several c++ class in c#. >> I have a problem with a template method. I think I understand the way >> templates are managed through SWIG but this one is quiet complex: >> >> class RegistrationManager >> { >> >> public: >> template <class T> >> void registerService(std::string iServiceName, >> ServiceObject::Status_t >> (T::*method)(string iPack,string iService, >> Message& Message), std::string iClassName, std::string iMethodName); >> ...} >> >> I include this decalration in the interface file with the template >> instanciation required : >> >> %template(registerServiceObject) >> RegistrationManager::registerService<ServiceObject>; >> >> ServiceObject is a class previously defined. >> >> Here is what swig generates in c# : >> >> public void registerServiceObject(string iServiceName, >> SWIGTYPE_m_T__f_r_q_const__otf__ServicePack_t_r_q_const__otf__S >> ervice_t_r_otf__InboundMessage__otf__RunnableObject__Status_t >> method, string iClassName, string iMethodName) >> >> As you can see the second parameter is quiet weird. Do I forgot to do >> something? >> > > This is basically the same problem I'm having. The %template directive > generates the wrapper correctly but does not seem to work for method > arguments/return values. > It's not necessarily the same problem. This one is about using a member function pointer in a templated function. There is a non-templated test for member function pointers in Examples/test-suite/member_pointer.i which you might want to have a look at (it uses %constant like C function pointers). BTW, the 'weird' parameter is a "Type wrapper" class, see the docs. William ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
| Free Forum Powered by Nabble | Forum Help |