[cl-prevalence-cvs] CVS update: cl-prevalence/src/package.lisp cl-prevalence/src/prevalence.lisp cl-prevalence/src/serialization.lisp

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Mon Oct 4 14:25:14 UTC 2004


Update of /project/cl-prevalence/cvsroot/cl-prevalence/src
In directory common-lisp.net:/tmp/cvs-serv20795/src

Modified Files:
	package.lisp prevalence.lisp serialization.lisp 
Log Message:
added reset-class-slots

Date: Mon Oct  4 16:25:13 2004
Author: scaekenberghe

Index: cl-prevalence/src/package.lisp
diff -u cl-prevalence/src/package.lisp:1.4 cl-prevalence/src/package.lisp:1.5
--- cl-prevalence/src/package.lisp:1.4	Mon Jun 28 13:57:30 2004
+++ cl-prevalence/src/package.lisp	Mon Oct  4 16:25:13 2004
@@ -1,6 +1,6 @@
 ;;;; -*- Mode: LISP -*-
 ;;;;
-;;;; $Id: package.lisp,v 1.4 2004/06/28 11:57:30 scaekenberghe Exp $
+;;;; $Id: package.lisp,v 1.5 2004/10/04 14:25:13 scaekenberghe Exp $
 ;;;;
 ;;;; Package definitions for the CL-PREVALENCE project
 ;;;;
@@ -16,7 +16,8 @@
    #:serializable-slots
    #:serialize-xml #:serialize-sexp
    #:deserialize-xml #:deserialize-sexp
-   #:make-serialization-state)
+   #:make-serialization-state
+   #:reset-known-slots)
   (:documentation "XML and s-expression based serialization for Common Lisp and CLOS"))
 
 (defpackage :cl-prevalence


Index: cl-prevalence/src/prevalence.lisp
diff -u cl-prevalence/src/prevalence.lisp:1.6 cl-prevalence/src/prevalence.lisp:1.7
--- cl-prevalence/src/prevalence.lisp:1.6	Tue Jul 13 12:30:28 2004
+++ cl-prevalence/src/prevalence.lisp	Mon Oct  4 16:25:13 2004
@@ -1,6 +1,6 @@
 ;;;; -*- mode: Lisp -*-
 ;;;;
-;;;; $Id: prevalence.lisp,v 1.6 2004/07/13 10:30:28 scaekenberghe Exp $
+;;;; $Id: prevalence.lisp,v 1.7 2004/10/04 14:25:13 scaekenberghe Exp $
 ;;;;
 ;;;; Object Prevalence in Common Lisp
 ;;;;
@@ -367,6 +367,11 @@
 	 (write-sequence buffer out :end read-count)
 	 (when (< read-count 4096) (return)))))))
   
+;;; from the serialization package 
+
+(defmethod reset-known-slots ((system prevalence-system) &optional class)
+  (reset-known-slots (get-serialization-state system) class))
+
 ;;; extra documentation
 
 (setf (documentation 'get-guard 'function) "Access the guard function of a sytem")


Index: cl-prevalence/src/serialization.lisp
diff -u cl-prevalence/src/serialization.lisp:1.3 cl-prevalence/src/serialization.lisp:1.4
--- cl-prevalence/src/serialization.lisp:1.3	Mon Oct  4 15:45:56 2004
+++ cl-prevalence/src/serialization.lisp	Mon Oct  4 16:25:13 2004
@@ -1,6 +1,6 @@
 ;;;; -*- mode: Lisp -*-
 ;;;;
-;;;; $Id: serialization.lisp,v 1.3 2004/10/04 13:45:56 scaekenberghe Exp $
+;;;; $Id: serialization.lisp,v 1.4 2004/10/04 14:25:13 scaekenberghe Exp $
 ;;;;
 ;;;; XML and S-Expression based Serialization for Common Lisp and CLOS
 ;;;;
@@ -52,6 +52,9 @@
   "Create a reusable serialization state to pass as optional argument to [de]serialize-xml"
   (make-instance 'serialization-state))
 
+(defgeneric reset-known-slots (serialization-state &optional class)
+  (:documentation "Clear the caching of known slots for class, or for all classes if class is nil"))
+
 ;;; Implementation
 
 ;; State and Support
@@ -74,6 +77,12 @@
   (with-slots (hashtable counter) serialization-state
     (clrhash hashtable)
     (setf counter 0)))
+
+(defmethod reset-known-slots ((serialization-state serialization-state) &optional class)
+  (with-slots (known-slots) serialization-state
+    (if class
+        (remhash (if (symbolp class) class (class-name class)) known-slots)
+      (clrhash known-slots))))
 
 (defmethod known-object-id ((serialization-state serialization-state) object)
   (gethash object (get-hashtable serialization-state)))





More information about the Cl-prevalence-cvs mailing list