Docs GODI Archive
Projects Blog Link DB

Search GODI:


More options
File lib/ocaml/pkg-lib/hweak/weak_memo.mli GODI Package godi-hweak
Library hweak
 
   weak_memo.cmi_pretty    weak_memo.mli    Sources  
(***********************************************************************)
(*                                                                     *)
(*                           HWeak                                     *)
(*                                                                     *)
(*                        Remi Vanicat                                 *)
(*                                                                     *)
(*  Copyright 2002 Rémi Vanicat                                        *)
(*  All rights reserved.  This file is distributed under the terms of  *)
(*  the GNU Library General Public License, with the special exception *)
(*  on linking described in the LICENCE file of the Objective Caml     *)
(*  distribution                                                       *)
(*                                                                     *)
(*  The original Idea come from the GUtil.memo class of the lablgtk    *)
(*  library                                                            *)
(*                                                                     *)
(***********************************************************************)

(** Suport for upcast of object.
  
  This module contain the [Weak_memo.c] class that contain object that 
  can be recover latter from the same object with a different type. An
  object that is into a [Weak_memo.c] object is not prevented from
  recolection by the Gc. *)

(** The memo class.

  [new Weak_memo.c size] create a new memo object with an original size
  of [size]. *)
class ['a] c : int ->
object
  constraint 'a = (< .. > as 'a)
  method add : 'a -> unit
    (** Add an object to the memo. This won't prevent this object to be
      recolect by the Gc.
    
      Do nothing if the object is already there. *)
  method clear : unit -> unit
    (** Empty the memo object. *)
  method count : int
    (** Return the number of object in the memo. *)
  method find : < .. > -> 'a
    (** Find an object that is physicaly equal to the object given as
      argument.

      Raise [Not_found] if there is none. *)
  method mem : < .. > -> bool
    (** Return true if there is an object in the memo that is equal to the
      object given as argument. Return false otherwise. *)
  method remove : < .. > -> unit
    (** Remove an object that is physicaly equal to the object given as
      argument if there is one.
      
      Do nothing otherwise. *)
end
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml