Preliminary work on ops.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/core/defs.lisp b/core/defs.lisp
index 51626b8..f89991b 100644
--- a/core/defs.lisp
+++ b/core/defs.lisp
@@ -34,6 +34,17 @@
(defgeneric probe-generic-function (probe))
+;; Operations
+
+(defclass operation ()
+ ((name :initarg :name
+ :initform (error "Operation without a name.")
+ :reader op-name
+ :type symbol)
+ (properties :initarg :properties
+ :initform (error "Operation without properties.")
+ :reader op-properties)))
+
;; Resource metaclass
(defvar *the-resource-class*)
@@ -43,22 +54,32 @@
:initform ()
:reader direct-probes
:type list)
+ (direct-ops :initarg :direct-ops
+ :initform ()
+ :reader direct-ops
+ :type list)
(probes :reader probes-of
- :type list))
+ :type list)
+ (ops :reader ops-of
+ :type list))
(:default-initargs :direct-superclasses (list *the-resource-class*)))
(defmethod closer-mop:validate-superclass ((c resource-class)
(super standard-class))
t)
-(defmacro define-resource-class (name direct-superclasses
- direct-slots direct-probes
- &optional options)
+(defmacro define-resource-class (name &optional
+ direct-superclasses
+ direct-slots
+ direct-probes
+ direct-ops
+ options)
`(defclass ,name ,(or direct-superclasses
'(resource))
,direct-slots
- (:metaclass resource-class)
+ (:direct-ops ,@direct-ops)
(:direct-probes ,@direct-probes)
+ (:metaclass resource-class)
,@options))
(defgeneric probe-class (resource-class))