]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
CA-44731: Add Fring.copy, needed in order to write an RRD copy function.
authorDavid Scott <dave.scott@eu.citrix.com>
Tue, 12 Oct 2010 11:09:56 +0000 (12:09 +0100)
committerDavid Scott <dave.scott@eu.citrix.com>
Tue, 12 Oct 2010 11:09:56 +0000 (12:09 +0100)
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
stdext/fring.ml
stdext/fring.mli

index 4b64ebf3de66c55a27a8ac40ad94915de171a602..e6b5fbdbd9836551a64711216887434dd9ed1989 100644 (file)
@@ -23,6 +23,13 @@ let make size init =
        done;
        ring
 
+let copy x = 
+       let y = make x.size 0. in
+       for i = 0 to Bigarray.Array1.dim x.data - 1 do
+               Bigarray.Array1.set y.data i (Bigarray.Array1.get x.data i)
+       done;
+       y
+
 let length ring = ring.size
 
 let push ring e =
index 38a60d1a99019e60a56d3329264a68073c51f000..c14aa503ff56aaad4dfee1bda200c94fd96256bf 100644 (file)
@@ -22,6 +22,9 @@ type t = {
 (** create a ring structure with [size] record; records initialised to [init] *)
 val make : int -> float -> t
 
+(** create a duplicate ring structure *)
+val copy : t -> t
+
 (** length of the ring *)
 val length : t -> int