aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/stamps.ml
blob: 0441d2de163dde76e1852c2db1d0b2943100a4b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

(* $Id$ *)

let new_stamp = 
  let stamp_ctr = ref 0 in
  fun () -> incr stamp_ctr; !stamp_ctr

type 'a timestamped = { stamp : int; ed : 'a }

let ts_stamp st = st.stamp
let ts_mod f st = { stamp = new_stamp(); ed = f st.ed }
let ts_it st = st.ed
let ts_mk v = { stamp = new_stamp(); ed = v}
let ts_eq st1 st2 = st1.stamp = st2.stamp

type 'a idstamped = 'a timestamped

let ids_mod f st = { stamp = st.stamp; ed = f st.ed}
let ids_it = ts_it
let ids_mk = ts_mk
let ids_eq = ts_eq