 
 import Foundation
 
-// TODO 
-// HEADER = H
-// OBJECT = O
-
-class ObjectStore<O: ObjectCoding, H> : DataStore<O,H> {
+class ObjectStore<O: PersistentObject, H: DataStoreHeader> : DataStore<O.DataType,H> {
     
     //var objectType : Class!
     


    func addObject(aObj: O) -> UID {
        
        aObj.uid = self.create(aObj.encodeData())
        
        aObj.dirty = false
        
        return aObj.uid!
    }
    
    
    func readObject(aID: UID) -> O? {
        
        var data = self.read(aID)
        
        if data.length > 0 {
            var result = O(data: data)
            result.uid = aID
            
            return result

    func deleteObject(aObj: O) {
        
        if aObj.uid {
            self.deleteData(aObj.uid!)
            aObj.uid = nil;
        }
    }
