Frama-C:
Plug-ins:
Libraries:

Frama-C API - Caml_weak_hashtbl

Build a weak hashtbl over a datatype Data by using Weak.Make provided by the OCaml standard library. Note that the table is not saved on disk.

  • since Boron-20100401

Parameters

module Data : Datatype.S
module _ : Info_with_size

Signature

Hashtbl are a standard computation. BUT it is INCORRECT to use projectified hashtables if keys have a custom rehash function (see Datatype.Make_input.rehash)

include S
val self : State.t

The kind of the registered state.

val name : string
val mark_as_computed : ?project:Project.t -> unit -> unit

Indicate that the registered state will not change again for the given project (default is current ()).

val is_computed : ?project:Project.t -> unit -> bool

Returns true iff the registered state will not change again for the given project (default is current ()).

Exportation of some inputs (easier use of State_builder.Register).

val add_hook_on_update : (Datatype.t -> unit) -> unit

Add an hook which is applied each time (just before) the project library changes the local value of the state.

  • since Nitrogen-20111001
val howto_marshal : (Datatype.t -> 'a) -> ('a -> Datatype.t) -> unit

howto_marshal marshal unmarshal registers a custom couple of functions (marshal, unmarshal) to be used for serialization. Default functions are identities. In particular, this function must be used if Datatype.t is not marshallable and do_not_save is not called.

  • since Boron-20100401
type data = Data.t
  • since Boron-20100401
val merge : data -> data

merge x returns an instance of x found in the table if any, or else adds x and return x.

  • since Boron-20100401
val add : data -> unit

add x adds x to the table. If there is already an instance of x, it is unspecified which one will be returned by subsequent calls to find and merge.

  • since Boron-20100401
val clear : unit -> unit

Clear the table.

  • since Boron-20100401
val count : unit -> int

Length of the table.

  • since Boron-20100401
val iter : (data -> unit) -> unit
  • since Boron-20100401
val fold : (data -> 'a -> 'a) -> 'a -> 'a
  • since Boron-20100401
val find : data -> data

find x returns an instance of x found in table.

  • raises Not_found

    if there is no such element.

  • since Boron-20100401
val find_all : data -> data list

find_all x returns a list of all the instances of x found in t.

  • since Boron-20100401
val mem : data -> bool

mem x returns true if there is at least one instance of x in the table, false otherwise.

  • since Boron-20100401
val remove : data -> unit

remove x removes from the table one instance of x. Does nothing if there is no instance of x.

  • since Boron-20100401