Skip to content
Browse files

[ADD] support for generic pids and serial pids.

  • Loading branch information...
1 parent fffd416 commit 396ddc7196823eb583541e602a7f093d83c6863c pgcrism committed
Showing with 79 additions and 0 deletions.
  1. +61 −0 epom/src/implementation/po_serial_pid.e
  2. +18 −0 epom/src/interface/po_generic_pid.e
View
61 epom/src/implementation/po_serial_pid.e
@@ -0,0 +1,61 @@
+note
+ description: "[
+ Typed Persistent Identifiers implemented using serial numbers."
+
+ copyright: "Copyright (c) 2012, Paul G. Crismer and others"
+ license: "Eiffel Forum License v2 (see forum.txt)"
+ date: "$Date: 2012/02/17 15:33:14 $"
+
+class
+ PO_SERIAL_PID [G -> PO_PERSISTENT]
+
+inherit
+ PO_GENERIC_PID [G]
+
+create {PO_ADAPTER}
+ make_serial,
+ make_serial_unsafe
+
+feature {NONE} -- Initialization
+
+ make_serial (a_serial : NATURAL_64; an_adapter : PO_ADAPTER[G])
+ -- Make using `a_serial', for `an_adapter'.
+ do
+ serial := a_serial
+ persistent_class_name := an_adapter.persistent_class_name
+ ensure
+ serial_set: serial = a_serial
+ persistent_class_name_set: persistent_class_name = an_adapter.persistent_class_name
+ end
+
+ make_serial_unsafe (a_serial : NATURAL_64; a_persistent_class_name : READABLE_STRING_8)
+ -- Make using `a_serial', for `a_persistent_class_name'
+ -- There is no guarantee that `a_persistent_class_name' is related to an adapter in the system.
+ do
+ serial := a_serial
+ persistent_class_name := a_persistent_class_name.twin
+ ensure
+ serial_set: serial = a_serial
+ persistent_class_name_set: persistent_class_name ~ a_persistence_class_name
+ end
+
+feature -- Access
+
+ persistent_class_name : READABLE_STRING_8
+
+ serial : NATURAL_64
+
+feature -- Conversion
+
+ as_string : STRING
+ local
+ s : STRING
+ do
+ s := serial.out
+ create Result.make (persistent_class_name.count + s.count)
+ Result.append_string (persistent_class_name)
+ Result.append_character ('#')
+ Result.append_string (s)
+ end
+
+end
View
18 epom/src/interface/po_generic_pid.e
@@ -0,0 +1,18 @@
+indexing
+
+ description:
+ "[
+ Typed Persistent Identifiers.
+ ]"
+
+ copyright: "Copyright (c) 2012, Paul G. Crismer and others"
+ license: "Eiffel Forum License v2 (see forum.txt)"
+ date: "$Date: 2012/02/17 15:33:14 $"
+
+deferred class
+ PO_GENERIC_PID [G -> PO_PERSISTENT]
+
+inherit
+ PO_PID
+
+end

0 comments on commit 396ddc7

Please sign in to comment.
Something went wrong with that request. Please try again.