X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fbasic_ag%2FbagEnvironment.ml;h=04681cfeee6cb7cb0934797782774490722b71fe;hb=689118326fbe47231865b26c66ae89144459be6a;hp=f145661723be6b4664d4d841a82d38dd216c3a81;hpb=36270146f49052f621553b0b45afe23813ed7e64;p=helm.git diff --git a/helm/software/lambda-delta/basic_ag/bagEnvironment.ml b/helm/software/lambda-delta/basic_ag/bagEnvironment.ml index f14566172..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 entry = 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_obj f obj = - let _, uri, b = obj in - let obj = !entry, uri, b in - incr entry; H.add env uri obj; f obj +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_obj f uri = +let get_entity f uri = try f (H.find env uri) with Not_found -> error uri