Module type Ringbuffer.R

module type R = sig .. end

Signature for ringbuffer modules.


type elt 

Type of elements contained in the ringbuffer.

type buffer = elt array 

A buffer of elements.

type t 

A ringbuffer.

val create : int -> t

Create a ringbuffer of given size.

val read_space : t -> int

Size of data available for reading.

val write_space : t -> int

Size of space available for writing.

val read_advance : t -> int -> unit

Drop data.

val write_advance : t -> int -> unit

Advance the write pointer.

val read : t -> buffer -> int -> int -> unit

Read data.

val peek : t -> buffer -> int -> int -> unit

Same as read but does not advance the read pointer.

val write : t -> buffer -> int -> int -> unit

Write data.

val transmit : t -> (buffer -> int -> int -> int) -> int

Read all the data in the ringbuffer.