<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>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</div><div>the OpenCV Point_ class defined here http://docs.opencv.org/modules/core/doc/basic_structures.html?highlight=assignto#Point_<br></div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">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:</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida
Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">(defun point (&optional (x nil) (y nil))
<br> (cond ((eq (or x y) nil)
<br> (point0))
<br> ((and x y)
<br> (point2 x y))
<br> (t nil)))
<br> </div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">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.</div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color:
transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 13.3333px; font-family: HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif; background-color: transparent; font-style: normal;">;; Point* cv_create_Point(int x, int y)
<br>(defcfun ("cv_create_Point" point0) (:pointer point)
<br> "Point constructor")
<br> <br> <br>;; Point* cv_create_Point(int x, int y)
<br>(defcfun ("cv_create_Point2" point2) (:pointer point)
<br> "Point constructor"
<br> (x :int)
<br> (y :int))
<br> <br>;; _Tp x, y
<br>;; int cv_Point_getX(Point* self)
<br>(defcfun ("cv_Point_getX" point-x) :int
<br> "Retrieves X coordinate of a point"
<br> (self (:pointer point)))
<br> <br> <br>;; _Tp x, y
<br>;; int cv_Point_getY(Point* self)
<br>(defcfun ("cv_Point_getY" point-y) :int
<br> "Retrieves y coordinate of a point"
<br> (self
(:pointer point)))
<br><br></div></div></body></html>