Module Streamlines.Core.Info

exception Bad_value of string

Bad_value why exception

type t_value =
| Str of string
| Int of int
| Int32 of int32
| Uint of int
| Uint32 of int32
| Float32 of float

t_value Variant type to handle the values potentially required to be passed to OpenCL - ths info struct is used to generate the compiler options

type t_named_value = string * t_value

t_named_value - A named value that is the basic element of the Info structure

type t = {
mutable info : t_named_value list;
}

t - structure type of an Info module, just a list of named values

val value_str : t_value ‑> string

value_str v - return string representation of a value

The string returned is suitable for inclusion in a '-Dfred=<x>'

val type_str : t_value ‑> string

type_str v - return string representation of the type of a value

This is used for display purposes, not for communication with the OpenCL compiler.

val define_str : (string * t_value) ‑> string

define_str nv - generate '-D<name>=<value>' string for the OpenCL compiler

val create : 'a ‑> t

create _ - create an Info block

val set : t ‑> string ‑> t_value ‑> unit

set t name value

This is for internal use; externally functions such as set_float32 should be used. so that t_value constructors need not be used.

val set_uint : t ‑> string ‑> int ‑> unit

add_uint t name x

Set name/(unsigned int x) as a name/value pair in the Info block

val set_uint32 : t ‑> string ‑> int32 ‑> unit

set_uint32 t name x

Set name/(unsigned int32 x) as a name/value pair in the Info block

val set_float32 : t ‑> string ‑> float ‑> unit

set_float32 t name x

Set name/(float32 x) as a name/value pair in the Info block

val set_str : t ‑> string ‑> string ‑> unit

set_str t name x

Set name/(string x) as a name/value pair in the Info block.

val int_of : t ‑> string ‑> int

int_of t name

Get int of the value of name in the Info block; this works for values that are int32s, or similar, but if an int cannot be created than a Bad_value exception is raised.

val str_of : t ‑> string ‑> string

str_of t name

Get string of the value of name in the Info block. If it is not a string then a Bad_value is raised.

val float_of : t ‑> string ‑> float

float_of t name

Get float of the value of name in the Info block; this works for values that are ints, or similar, but if a float cannot be created than a Bad_value exception is raised.

val iter : (t_named_value ‑> unit) ‑> t ‑> unit

iter f t

Apply f to every name/value pair in the Info block

val fold_left : ('a ‑> t_named_value ‑> 'a) ‑> 'a ‑> t ‑> 'a

fold_left f acc t

Fold f over every name/value pair in the Info block

val display : t ‑> unit

display

Print out the info block contents prettily for debug, for example