[cells-devel] Lots of instances, callback when particular instance changes
Josip Gracin
gracin at tel.fer.hr
Fri May 4 20:41:26 UTC 2007
Here's what I'm currently doing (just an outline):
(defmodel switch (component)
((switch-position :cell t
:initarg :switch-position
:initform (c-in :off)
:accessor switch-position)
(change-handler :cell nil
:initform nil
:initarg :change-handler
:reader switch-change-handler)))
(def-c-output switch-position (self new-value old-value)
(when (switch-change-handler self)
(funcall (switch-change-handler self) self new-value old-value)))
And then create instances:
...
(mksys 'switch :main-battery-switch)
(mksys 'switch :apu-start-switch
:change-handler 'apu-start-switch-change-handler)
...
The reason I need the change handler is that the change handler has to
modify the value of the self switch. For example, when apu-start-switch
changes its value to :START, change handler schedules an action which
will set the switch back to :ON after some time. I fail to see how I
can do this using regular slot-dependency mechanisms provided by Cells.
Am I making any sense?
More information about the cells-devel
mailing list