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
|