Hi Chris,
> the problem is that the C library has several functions that will accept
> one
> of many types of arrays.
>
> The function parameter type is CvArr whose definition is (in C):
>
> typedef void CvArr;
>
> and the functions are declared as accepting CvArr* types as arguments.
>
> two of the types I am wrapping are IplImage and CvMat both of which can be
> passed as CvArr*.
>
> I would like to make python callable functions that accept either instance
> of IplImage or CvMat (which I have created as extension types).
>
> Unfortunately, i haven't yet been able to figure it out through various
> tinkering with subclassing, casting, or void pointers....
Note that
def f(CvMat foo): ...
is almost exactly the same as
def f(foo):
if not isinstance(foo, CvMat): raise some error...
So, what you do is
def f(obj):
if isinstance(foo, CvMat): (a)
elif isinstance(foo, IplImage): (b)
else: raise some error
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev