casadi/casadi — pull request #882 by jgillis (2013-11-05 09:07:30+00:00)
Title: Alternative callback mechanism

(not ready to merge)

This is a proposal to replace C Function pointer arguments by Functor objects.

Why?
- Right now, for python, a PyObject is assigned to user_data when registering a callback. But what about jacobianGenerator and sparsityGenerator? Should they start sharing that user_data? This solution as clumsy from the start
- Functors being objects, we can subclass in python to hold also the pointer to the PyObject and do proper reference counting (!)
- Implicit casting from from C Function pointers to Functors is easily achieved -> backwards compatible

see also #878 #879