Alexandre Peçanha
unread,Mar 17, 2012, 9:30:05 AM3/17/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to swig...@lists.sourceforge.net
Hi all,
(Sorry if it is replicated, I had NOOB issues in the registration)
I've implemented in following idea in cpp and it's working very well but I
didn't seen an easy way to wrap it in Swig/Python does anyone may give-me
some advice/idea/suggestion?
#Definitions:
IComponent - Abstract base class
AComponent - Derived from IComponent
BComponent - Derived from IComponent
vector<IComponent*> storage
void AddComponent(ComponentA comp) //Adds comp to storage
void AddComponent(ComponentB comp)
IComponent* GetComponent(int key) //Returns the component
In cpp I can use the members that are defined in IComponent (and implemented
in the derived classes) without any problem, but when it is wrapped things
turn dark...
The methods are perfectly wrapped but, as we would expect, IComponent* from
GetComponent is returned as a Swig_Ptr and the member methods could not be
used from Python.
Based on that does anyone have an idea/suggestion on how get an instance of
an IComponent that is usable from Python (remebering that IComponet is an
abstract class).
Thanks in advance,
Alex