X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fbasic_ag%2FbagEnvironment.ml;h=04681cfeee6cb7cb0934797782774490722b71fe;hb=7f89b4dce54266c281479a14c01edc4bd33993d1;hp=35fab4db32c7f8a59cf58df3e7797072fc534b99;hpb=79684e8bd0f54b5c88fff981366bd8c78dd0fbe9;p=helm.git diff --git a/helm/software/lambda-delta/basic_ag/bagEnvironment.ml b/helm/software/lambda-delta/basic_ag/bagEnvironment.ml index 35fab4db3..04681cfee 100644 --- a/helm/software/lambda-delta/basic_ag/bagEnvironment.ml +++ b/helm/software/lambda-delta/basic_ag/bagEnvironment.ml @@ -12,24 +12,28 @@ module U = NUri module L = Log module H = U.UriHash +module Y = Entity module B = Bag exception ObjectNotFound of B.message let hsize = 7000 let env = H.create hsize -let age = ref 1 (* Internal functions *******************************************************) +let get_age = + let age = ref 0 in + fun () -> incr age; !age + let error uri = raise (ObjectNotFound (L.items1 (U.string_of_uri uri))) (* Interface functions ******************************************************) -let set_entry f entry = - let _, uri, b = entry in - let entry = !age, uri, b in - incr age; H.add env uri entry; f entry +let set_entity f (a, uri, b) = + let age = get_age () in + let entry = (Y.Apix age :: a), uri, b in + H.add env uri entry; f entry -let get_entry f uri = +let get_entity f uri = try f (H.find env uri) with Not_found -> error uri