Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 74 lines (61 sloc) 2.345 kb
fccc685 Initial open-source release
MLstate authored
1 (*
2 Copyright © 2011 MLstate
3
4 This file is part of OPA.
5
6 OPA is free software: you can redistribute it and/or modify it under the
7 terms of the GNU Affero General Public License, version 3, as published by
8 the Free Software Foundation.
9
10 OPA is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
13 more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with OPA. If not, see <http://www.gnu.org/licenses/>.
17 *)
18 (**
19 the original module from the stdlib
20 *)
21 type ('a, 'b) t = ('a,'b) Hashtbl.t
22 val create : int -> ('a, 'b) t
23 val clear : ('a, 'b) t -> unit
24 val add : ('a, 'b) t -> 'a -> 'b -> unit
25 val copy : ('a, 'b) t -> ('a, 'b) t
26 val find : ('a, 'b) t -> 'a -> 'b
27 val find_all : ('a, 'b) t -> 'a -> 'b list
28 val mem : ('a, 'b) t -> 'a -> bool
29 val remove : ('a, 'b) t -> 'a -> unit
30 val replace : ('a, 'b) t -> 'a -> 'b -> unit
31 val iter : ('a -> 'b -> unit) -> ('a, 'b) t -> unit
32 val fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c
33 val length : ('a, 'b) t -> int
34
35 module type HashedType = Hashtbl.HashedType
36 module type S = sig
37 include Hashtbl.S
38 val replace_content :'a t -> 'a t -> unit
39 val find_opt : 'a t -> key -> 'a option
40 end
41 module Make (H : HashedType) : S with type key = H.t
42
43 val hash : 'a -> int
44 external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"
45
46 (**
47 additional functions
48 *)
49
50 val find_opt : ('a,'b) Hashtbl.t -> 'a -> 'b option
51
52 val replace_content : ('a,'b) Hashtbl.t -> ('a,'b) Hashtbl.t -> unit
53 (**
54 [replace_content h1 h2] behaves as [h1 <- h2] if this operation was possible
55 It is unspecified whether modifying the [h2] affects [h1].
56 If you want the hashtbl to "diverge", use [replace_content h1 (copy h2)].
57 If you want the hashtbl to share their changes, well, too bad for you,
58 that's not possible. Use references over your hashtbl instead.
59 *)
60
61 (**
62 Magic combinator for hashes.
63 Stolen from ocaml sources
64 *)
65 val combine : int -> int -> int
66
67 (** {6 Extension} *)
68
69 (**
70 Pick an unspecified element of a [Hashtbl], and remove it.
71 Nothing happens if the table is empty.
72 *)
73 val pick_remove : ('a, 'b) t -> unit
Something went wrong with that request. Please try again.