module Netshm_array:Arrays in shared memorysig
..end
type 'a
t
val manage : ?pagesize:int ->
?init:int ->
'a ->
'a Netshm_data.data_manager ->
Netshm.locking_method -> Netshm.shm_descr -> 'a t
'a
is the default value of the
array elements.
This bases on Netshm.manage
, and the arguments pagesize
,
locking_method
and shm_descr
are documented there.
If an empty memory object is managed, it is initialized as array with zero elements. If a non-empty memory object is managed, it must contain a valid array structure. The size of the array is then the same as when the array was managed the last time.
By passing init
with argument n
, the array is reinitialized as
array with n
elements containing the default value.
It is essential that the same data managers are passed as at the time when the array was initialized.
Arrays are implemented as (int32, 'a) Netshm_hashtbl.t
.
val length : 'a t -> int
val get : 'a t -> int -> 'a
get a k
: Returns the contents of the array element number k
where
0 <= k < length a
.
If you do module Array = Netshm_array
in your code you can also
use the notation a.(k)
.
val set : 'a t -> int -> 'a -> unit
set a k x
: Sets the contents of the array element number k
to x
where 0 <= k < length a
.
If you do module Array = Netshm_array
in your code you can also
use the notation a.(k) <- x
.
val resize : 'a t -> int -> unit
resize a n
: Resizes the array to length n
. If the array is enlarged
the new elements will be initialized to the default value.val default_value : 'a t -> 'a
val shm_table : 'a t -> Netshm.shm_table