X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Flambda-delta%2Fbasic_rg%2FbrgEnvironment.ml;h=5a4cf3cb6d0875cbda2ea881e68fb4c0160ba0d4;hb=34c2ba63c8eb5fccfd9a1fb8ac1df5895c8b58b3;hp=b0cb9596e3ea2848b5d36029a2e4f24e3131dd9e;hpb=25fba20748a951f7061188cc5fabece8f5ac97b9;p=helm.git diff --git a/helm/software/lambda-delta/basic_rg/brgEnvironment.ml b/helm/software/lambda-delta/basic_rg/brgEnvironment.ml index b0cb9596e..5a4cf3cb6 100644 --- a/helm/software/lambda-delta/basic_rg/brgEnvironment.ml +++ b/helm/software/lambda-delta/basic_rg/brgEnvironment.ml @@ -11,23 +11,24 @@ module U = NUri module H = U.UriHash +module Y = Entity module B = Brg -exception ObjectNotFound of string Lazy.t - let hsize = 7000 let env = H.create hsize -let entry = ref 0 (* Internal functions *******************************************************) +let get_age = + let age = ref 0 in + fun () -> incr age; !age + (* Interface functions ******************************************************) -let set_obj f obj = - let _, uri, b, t = obj in - let obj = !entry, uri, b, t in - incr entry; H.add env uri obj; f obj +let set_entity f (a, uri, b) = + let age = get_age () in + let entity = (Y.Apix age :: a), uri, b in + H.add env uri entity; f entity -let get_obj f uri = - try f (H.find env uri) - with Not_found -> raise (ObjectNotFound (lazy (U.string_of_uri uri))) +let get_entity err f uri = + try f (H.find env uri) with Not_found -> err ()