Hi -
I want to control if a kid is added to a parent based on the execution of a check function. The check function is supposed to throw an condition when the check fails.
Current use case:
Control which classes of kids are added to a parent. I do have a model of class BOM (bill of material) that only can accept classes Assembly and Part as kids.
I found two places at which I could insert a call to the check function:
function fm-kid-add (higher level interface) function fm-kid-insert (lower level interface)
Question now is: Why would one be better than the other?
Idea here is based on adding a new slot to class family:
(defmodel family (model) ((.kid-slots :cell nil :initform nil :accessor kid-slots :initarg :kid-slots) (.kids :initform (c-in nil) ;; most useful :owning t :accessor kids :initarg :kids) (registry? :cell nil :initform nil :initarg :registry? :accessor registry?) (registry :cell nil :initform nil :accessor registry) ;; added: frgo, 2008-10-30 ----- (kid-add-control-hook :cell nil :initform nil :initarg: kid-add-control-hook)))
and then do run the check functions that have been added to the control hook (= list of functions to be funcalled).
Right approach? Any comments? (It works but I'd like to know if am on the right track).
Thanks for feedback.
Cheers Frank