1 (***********************************************************************)
5 (* Kim Nguyen, LRI UMR8623 *)
6 (* Université Paris-Sud & CNRS *)
8 (* Copyright 2010-2012 Université Paris-Sud and Centre National de la *)
9 (* Recherche Scientifique. All rights reserved. This file is *)
10 (* distributed under the terms of the GNU Lesser General Public *)
11 (* License, with the special exception on linking described in file *)
14 (***********************************************************************)
16 module type Abstract =
24 val equal : t -> t -> bool
25 val init : unit -> unit
28 type 'a node = { id : Uid.t;
34 type t = private { id : Uid.t;
37 include Abstract with type data := data and type t := t
40 module type TableBuilder =
42 (H : Sigs.HashedType) ->
43 Sigs.HashSet with type data = H.t
45 module Builder (TB : TableBuilder) (H : Sigs.HashedType) =
48 type t = { id : Uid.t;
51 let uid_make = ref (Uid.make_maker())
55 let equal t1 t2 = t1 == t2
61 let equal x y = x == y || H.equal x.node y.node
65 let pool = T.create 101
68 uid_make := Uid.make_maker ()
71 let cell = { id = Uid.dummy; key = H.hash x; node = x } in
76 let cell = { cell with id = !uid_make(); } in
81 module Make = Builder (Utils.HashSet)
82 module Weak = Builder (Weak.Make)
89 if v < 0 then raise (Invalid_argument "Hcons.PosInt.make")
93 let uid v = Uid.of_int v
94 let equal x y = x == y