/// <summary> /// Save an object. This will return the object id for the Saveable /// passed in. If this saveable was already found it will return the /// previously assigned id, otherwise it will make a new one. If save is /// null then this function will return NullObject; /// </summary> /// <param name="save">The object to identify and save.</param> /// <returns>See description.</returns> internal long saveObject(Saveable save) { if (save == null) { return(NullObject); } if (identiferMap.ContainsKey(save)) { return(identiferMap[save].ObjectID); } else { SaveInfo info = checkOutSaveInfo(); ObjectIdentifier identifier = new ObjectIdentifier(currentObjectID++, save, save.GetType()); identiferMap.Add(save, identifier); save.getInfo(info); writeObject(identifier, info); checkInSaveInfo(info); return(identifier.ObjectID); } }