class interface SIGNAL_0
--
-- See tutorial/signal/signals.txt for usage
--
creation
make
-- Initialize new signal object
ensure
callbacks.is_empty
feature(s) from SIGNAL_0
callbacks: FAST_ARRAY[PROCEDURE[ANY,TUPLE]]
index: INTEGER
last: INTEGER
-- work to do while emit is between index and last.
make
-- Initialize new signal object
ensure
callbacks.is_empty
feature(s) from SIGNAL_0
connect (p: PROCEDURE[ANY,TUPLE])
-- Connect procedure to be called when signal is emitted
-- See also last_connect_id
require
p /= Void
ensure
not callbacks.is_empty;
last_connect_id = p
emit
-- Emit signal, ie. already registred procedure will be called
-- in registration order except if removed by another before.
last_connect_id: PROCEDURE[ANY,TUPLE]
-- return identifier on the last connect which may be used
-- for disconnect (unregister procedure)
require
not is_empty
ensure
Result /= Void
disconnect (connect_identifier: PROCEDURE[ANY,TUPLE])
-- Unregister procedure for this signal. If the same
-- procedure was registred many times, only first is removed.
ensure
old callbacks.fast_has(connect_identifier) implies callbacks.count = old callbacks.count - 1;
old not callbacks.fast_has(connect_identifier) implies callbacks.count = old callbacks.count
is_empty: BOOLEAN
-- return True if no callback is registred for this signal
invariant
callbacks /= Void;
end of SIGNAL_0