initialize-saved/sent-instance |
| instance slots
| [Generic Function] |
Purpose
Initializes the slots of instance when reading saved (or
sent) values.
Method signatures
( instance standard-object)
slots slot-values missing-slot-names
=> instance
|
( instance standard-unit-instance)
slots slot-values missing-slot-names
=> instance
|
( instance standard-space-instance)
slots slot-values missing-slot-names
=> instance
|
Package :gbbopen-tools
Module :gbbopen-tools
(the unit-instance and
space-instance methods are added by :gbbopen-core
Arguments and values
instance | A standard-object instance
| |
slots | A list of effective-slot-definition objects
| |
slot-values | A list of values (corresponding to the slots in slots) | |
missing-slot-names | A list of symbols naming slots and slot values that
were saved/sent, but which are no longer present in the class definition of
|
Returns
The instance.
Description
Initialize-saved/sent-instance is called when loading a blackboard
repository or journal or when reading a network-streamer
connection; it should not be called directly.
See also
load-blackboard-repository
with-reading-saved/sent-objects-block
Examples
Restore the binary value of slot song
in unit instances of
bird
that was saved/sent as a Base64 portable string (see the companion
encoding
example):
(defmethod initialize-saved/sent-instance :after ((bird bird) slots slot-values missing-slot-names) (declare (ignore slots slot-values missing-slot-names)) (setf (song-of bird) (base64-decode (song-of bird))))Transfer the slot value that was saved/sent as the slot named
old-slot
new-slot
hyp
:
(defmethod initialize-saved/sent-instance :after ((hyp hyp) slots slot-values missing-slot-names) (declare (ignore missing-slot-names)) (let ((position (position 'old-slot slots :key #'slot-definition-name :test #'eq))) (setf (new-slot-of hyp) (nth position slot-values))))
The GBBopen Project
initialize-saved/sent-instance |