This commit is contained in:
Araq 2015-09-13 23:26:44 +02:00
commit 14354b436f
5 changed files with 40 additions and 13 deletions

View file

@ -0,0 +1,17 @@
import tables
type
UUIDObject* = ref object
uuid: string
Registry*[T] = ref object
objects: Table[string, T]
proc newRegistry*[T](): Registry[T] =
result = Registry[T]()
result.objects = initTable[string, T](128)
proc register*[T](self: Registry[T], obj: T) =
self.objects[obj.uuid] = obj