File: join_hash.mli

package info (click to toggle)
jocaml 4.01.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,736 kB
  • ctags: 23,836
  • sloc: ml: 111,262; ansic: 32,746; sh: 6,057; lisp: 4,230; makefile: 3,861; asm: 3,734; awk: 88; perl: 45; fortran: 21; sed: 19; cs: 9
file content (47 lines) | stat: -rw-r--r-- 1,768 bytes parent folder | download | duplicates (3)
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
(***********************************************************************)
(*                                                                     *)
(*                           Objective Caml                            *)
(*                                                                     *)
(*            Luc Maranget, projet Moscova, INRIA Rocquencourt         *)
(*                                                                     *)
(*  Copyright 2005 Institut National de Recherche en Informatique et   *)
(*  en Automatique.  All rights reserved.  This file is distributed    *)
(*  under the terms of the Q Public License version 1.0.               *)
(*                                                                     *)
(***********************************************************************)

(* $Id: join_hash.mli 7746 2006-11-20 16:47:41Z maranget $ *)

(*
  Hashtables  with readers/writer protection
*)

type ('a,'b) t

val create : unit -> ('a,'b) t

(* add a binding *)
val add :  ('a,'b) t -> 'a -> 'b -> unit

(* add a binding key, value
   if there is already a binding for key, will do nothing
   and returns the old value, otherwise will return None *)
val add_once  : ('a,'b) t -> 'a -> 'b -> 'b option

(* find a value, given a key, raise Not_found if not present *)
val find : ('a,'b) t -> 'a -> 'b

(* find and atomically remove a value *)
val find_remove  : ('a,'b) t -> 'a -> 'b

(* iterate over all bindings *)
val iter : ('a, 'b) t -> ('a -> 'b -> unit) -> unit

(* iterate over all bindings and empty table *)
val iter_empty : ('a, 'b) t -> ('a -> 'b -> unit) -> unit

(* remove a binding *)
val remove : ('a,'b) t -> 'a -> unit

(* Perform some operation on value *)
val perform : ('a,'b) t -> 'a -> 'b -> ('b -> 'b) -> unit