the *casting of the classes*!! thanks!! the situation was quite more complicate, with overloadings, typedefs over templates and multiple inheritances (the best of stl c++ and the nemesis of the interfaces!), but with a proper chain of casts a lot of obstacles are easily surpassed. I've struggled with undocumented features and parser bugs in boost.python for a couple of weeks, trying to do what I did in 2 days of cython!
thanks to the cython devs for their great work!! On Sat, Mar 21, 2009 at 3:44 PM, Lisandro Dalcin <[email protected]> wrote: > The private/public distinction in Cython is not as in C++, it is just > related to exposing C/C++ stuff to Python land... Inside a module > coded in Cython, everything is (in the C++ sense) public . > > Yur do_something_on_Polygon() is missing a "cast", or Cython does not > know that someting is actually a cdef class. > > def do_something_on_Polygon(self,Rectangle_list): > cdef Rectangle r = Rectangle_list[0] > self.thisptr.do_something(r.thisptr) > > > On Sat, Mar 21, 2009 at 5:09 AM, Christian Andreetta <[email protected]> > wrote: >> Hello, >> >> is there a way to access a C++ class private *thisptr from another >> class/function? >> something like (from wiki.cython.org/WrappingCPlusPlus): >> >> cdef class Rectangle: >> cdef c_Rectangle *thisptr >> def __cinit__(self): >> self.thisptr = new_Rectangle() >> # rest of implementation >> >> cdef class Obj_mangler: >> cdef c_Obj_mangler *thisptr >> def __cinit__(self): >> self.thisptr = new_Obj_mangler() >> def do_something_on_Polygon(self,Rectangle_list): >> # Rectangle_list is a list of Python objects wrappers >> # do_something is a void() c++ function accepting object pointers >> self.thisptr.do_something(Rectangle_list[0].thisptr) >> >> Thanks! >> _______________________________________________ >> Cython-dev mailing list >> [email protected] >> http://codespeak.net/mailman/listinfo/cython-dev >> > > > > -- > Lisandro Dalcín > --------------- > Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) > Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) > Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) > PTLC - Güemes 3450, (3000) Santa Fe, Argentina > Tel/Fax: +54-(0)342-451.1594 > _______________________________________________ > Cython-dev mailing list > [email protected] > http://codespeak.net/mailman/listinfo/cython-dev > _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
