]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/src/basic_rg/brgEnvironment.ml
the refactoring continues ....
[helm.git] / helm / software / lambda-delta / src / basic_rg / brgEnvironment.ml
diff --git a/helm/software/lambda-delta/src/basic_rg/brgEnvironment.ml b/helm/software/lambda-delta/src/basic_rg/brgEnvironment.ml
new file mode 100644 (file)
index 0000000..121da88
--- /dev/null
@@ -0,0 +1,35 @@
+(*
+    ||M||  This file is part of HELM, an Hypertextual, Electronic        
+    ||A||  Library of Mathematics, developed at the Computer Science     
+    ||T||  Department, University of Bologna, Italy.                     
+    ||I||                                                                
+    ||T||  HELM is free software; you can redistribute it and/or         
+    ||A||  modify it under the terms of the GNU General Public License   
+    \   /  version 2 or (at your option) any later version.              
+     \ /   This software is distributed as is, NO WARRANTY.              
+      V_______________________________________________________________ *)
+
+module U = NUri
+module H = U.UriHash
+module Y = Entity
+module B = Brg
+
+let hsize = 7000 
+let env = H.create hsize
+
+(* Internal functions *******************************************************)
+
+let get_age = 
+   let age = ref 0 in
+   fun () -> incr age; !age
+
+(* Interface functions ******************************************************)
+
+(* decps *)
+let set_entity (a, uri, b) =
+   let age = get_age () in
+   let entity = (Y.Apix age :: a), uri, b in
+   H.add env uri entity; entity
+
+let get_entity uri =
+   try H.find env uri with Not_found -> [], uri, Y.Void