changeset 698: | 96958d3eb5b0 |
parent: | 8252ee515756 |
author: | Richard Westhaver <ellis@rwest.io> |
date: | Fri, 04 Oct 2024 22:04:59 -0400 |
permissions: | -rw-r--r-- |
description: | fixes |
104
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
1 | ;;; lib/obj/id.lisp --- IDs |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
2 | (in-package :obj/id) |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
3 | |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
4 | (defclass id () |
115
7ed6bc70ca20
added basics of DB, included XDB, added IEEE floats to std/num module (new)
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
5 | ((id :initarg :id :initform 0 :accessor id :type fixnum))) |
104
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
6 | |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
7 | (defgeneric reset-id (obj) |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
8 | (:documentation "Reset the id slot of SELF to 0.") |
115
7ed6bc70ca20
added basics of DB, included XDB, added IEEE floats to std/num module (new)
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
9 | (:method ((obj standard-object)) (setf (id obj) 0)) |
104
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
10 | (:method ((obj t)) 0)) |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
11 | |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
12 | (defgeneric update-id (obj) |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
13 | (:documentation "Update the id slot of SELF.") |
115
7ed6bc70ca20
added basics of DB, included XDB, added IEEE floats to std/num module (new)
ellis <ellis@rwest.io>
parents:
104
diff
changeset
|
14 | (:method ((obj standard-object)) (setf (id obj) (hash-object obj))) |
104
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
15 | (:method ((obj t)) (hash-object obj))) |
6e5caf0c68a1
obj tree, id, hash, seq, graph.. added cli/progress and init cli/repl
ellis <ellis@rwest.io>
parents:
diff
changeset
|
16 | |
229 | 17 | (defgeneric make-id (kind) |
18 | (:documentation "Allocate a new ID object of a specified KIND.") |
|
19 | (:method ((kind (eql nil))) |
|
240
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
20 | (declare (ignore kind)) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
21 | (make-instance 'id)) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
22 | (:method ((kind (eql t))) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
23 | (declare (ignore kind)) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
24 | (make-instance 'id :id most-positive-fixnum))) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
25 | |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
26 | (defmethod print-object ((obj id) stream) |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
27 | (print-unreadable-object (obj stream :type "ID") |
a3b65a8138ac
html,http init, uuid, db stuff
Richard Westhaver <ellis@rwest.io>
parents:
229
diff
changeset
|
28 | (format stream "~A" (id obj)))) |
212
742e6d74752d
added sans-io module, more bits
Richard Westhaver <ellis@rwest.io>
parents:
115
diff
changeset
|
29 | |
742e6d74752d
added sans-io module, more bits
Richard Westhaver <ellis@rwest.io>
parents:
115
diff
changeset
|
30 | (defclass id-factory () ()) |
387 | 31 | |
32 | (defgeneric identify (self) |
|
33 | (:documentation "Return the identity of object SELF - usually meant for objects which don't |
|
34 | specialize on ID but should still sometimes return an ID.")) |