Module Imperative.MakeValuedNumberedNode

Same as MakeValuedNode, but also remembers all built node in a hash-table so we can check if elements already have an associated node

Parameters

module Value : Parameters.SIMPLE_GENERIC_VALUE with type ('a, 'b) relation = ('a, 'b) Relation.t

Signature

include sig ... end
val polyeq : 'a t -> 'b t -> ('a, 'b) PatriciaTree.cmp
module Relation : sig ... end
module Value : sig ... end
type !'a root = 'a MakeValuedNode(Elt)(Relation)(Value).root = {
  1. mutable value : 'a Value.t;
  2. mutable size : int;
}
type !'a parent = 'a MakeValuedNode(Elt)(Relation)(Value).parent =
  1. | Node : 'b t * ('a0, 'b) Relation.t -> 'a0 parent
  2. | Root of 'a root
val get_parent : 'a t -> 'a parent
val set_parent : 'a t -> 'a parent -> unit
val payload : 'a t -> 'a Elt.t

Inspect the payload of a node

val make_node : 'a Elt.t -> 'a Value.t -> 'a t

Create a new node with given value, in its own class. At most one node should be created per element!

val get_node : 'a Elt.t -> 'a t option

Checks if a node has already been constructed for the given element

val get_or_make_node : 'a Elt.t -> 'a Value.t -> 'a t

Returns the node associated with the given element if it exists, else builds it The value is only used when creating nodes