Module Flat_array

module Flat_array: sig .. end
An array of flat tuples.

A flat tuple is like an ordinary OCaml tuple, except it is second class and mutable. The flat tuples in a Flat_array.t are layed out sequentially in a single array, with each flat tuple's components immediately following the components of the prior flat tuple. A flat tuple is not first class -- one can only refer to a flat tuple via its index in the array holding it. Flat tuples are mutable via Flat_array.set.


module Slots: Tuple_type.Slots 
module Slot: Tuple_type.Slot 
type 'slots t 
The type of a flat-tuple array. 'slots will look like ('a1, ..., 'an) Slots.tn, and the array holds flat tuples of type 'a1 * ... * 'an.
include Blit.S1
include Invariant.S1
val create : ('tuple, 'a) Slots.t ->
len:int -> 'tuple -> ('tuple, 'a) Slots.t t
create slots ~len init creates an array of flat tuples, whose slots are initialized to the slots of init, which is an ordinary OCaml tuple. create raises if len < 0.
val copy : 'slots t -> 'slots t
copy a returns a shallow copy of a, that is, a fresh array containing the same elements as a.
val length : 'a t -> int
accessors
val slots : 'slots t -> 'slots
val get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
These functions get and set individual slots of flat tuple i in array t.

It is required that 0 <= i < length t.

val unsafe_get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
val set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val unsafe_set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val set_to_init : 'a t -> int -> unit
set_to_init t i sets flat tuple i to the init that was supplied to create.
val is_init : 'a t -> int -> bool
is_init t i returns true iff flat tuple i's slots are identical to those of the init supplied to create.
val get_all_slots : ('tuple, 'a) Slots.t t -> int -> 'tuple
get_all_slots t i allocates a new ordinary OCaml tuple whose components are equal to the slots of the flat tuple at index i of t. This is esentially an allocation plus a blit from t to the newly allocated tuple.

set_all_slots t i tuple sets all slots of the flat tuple at index i of t to their corresponding components of tuple. This is essentially a blit from tuple to t.

It is required that 0 <= i < length t.

val set_all_slots : ('tuple, 'a) Slots.t t -> int -> 'tuple -> unit
val sexp_of_t : ('slots -> Sexplib.Sexp.t) -> 'slots t -> Sexplib.Sexp.t

create slots ~len init creates an array of flat tuples, whose slots are initialized to the slots of init, which is an ordinary OCaml tuple. create raises if len < 0.

copy a returns a shallow copy of a, that is, a fresh array containing the same elements as a.

accessors

These functions get and set individual slots of flat tuple i in array t.

It is required that 0 <= i < length t.

set_to_init t i sets flat tuple i to the init that was supplied to create.

is_init t i returns true iff flat tuple i's slots are identical to those of the init supplied to create.

get_all_slots t i allocates a new ordinary OCaml tuple whose components are equal to the slots of the flat tuple at index i of t. This is esentially an allocation plus a blit from t to the newly allocated tuple.

set_all_slots t i tuple sets all slots of the flat tuple at index i of t to their corresponding components of tuple. This is essentially a blit from tuple to t.

It is required that 0 <= i < length t.