I have a bunch or C wrappers for C++ OpenCV code I'm writing and I was hoping someone could show me how the best way would be in CFFI to write theses functions. They're from a C++ class the OpenCV Point_ class defined here http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=assi...
Here are the functions below. So far I'm making the top 2 functions point0 and point2 use the same name "point" with this function:
(defun point (&optional (x nil) (y nil)) (cond ((eq (or x y) nil) (point0)) ((and x y) (point2 x y)) (t nil))) but I also have functions to retrieve the x and y coordinates of a point that belong to the same class. I call those point-x and point-y..I was hoping someone could write me up the best way on how to use these Point_ class wrappers . Is it with defclass or define-foreign-type or am I already doing a good job? I could use this info in making all my other class wrappers correctly.
;; Point* cv_create_Point(int x, int y) (defcfun ("cv_create_Point" point0) (:pointer point) "Point constructor") ;; Point* cv_create_Point(int x, int y) (defcfun ("cv_create_Point2" point2) (:pointer point) "Point constructor" (x :int) (y :int)) ;; _Tp x, y ;; int cv_Point_getX(Point* self) (defcfun ("cv_Point_getX" point-x) :int "Retrieves X coordinate of a point" (self (:pointer point))) ;; _Tp x, y ;; int cv_Point_getY(Point* self) (defcfun ("cv_Point_getY" point-y) :int "Retrieves y coordinate of a point" (self (:pointer point)))