4 using System.Collections.Generic;
7 namespace SiliconStudio.Quantum
16 private readonly Dictionary<object, Guid> objectGuids =
new Dictionary<object, Guid>();
21 if (obj == null)
return Guid.NewGuid();
26 if (!objectGuids.TryGetValue(obj, out guid))
28 objectGuids.Add(obj, guid = Guid.NewGuid());
40 return obj != null && objectGuids.TryGetValue(obj, out guid) ? guid : Guid.Empty;
47 if (obj == null)
throw new ArgumentNullException(
"obj");
51 objectGuids[obj] = guid;
60 object key = objectGuids.SingleOrDefault(x => x.Value == guid).Key;
61 return key != null && objectGuids.Remove(key);
bool UnregisterGuid(Guid guid)
Removes a Guid that was previously registered. The Guid to remove.true if a Guid has been actually re...
void Clear()
Clear the IGuidContainer, removing everything it references.
Base interface for Guid containers, object that can store a unique identifier for a collection of obj...
Handles Guid generation and storage for model nodes.
Guid GetGuid(object obj)
Gets the Guid for a given object, if available. The object.The Guid associated to the given object...
Guid GetOrCreateGuid(object obj)
Gets or or create a Guid for a given object. If the object is null, a new Guid will be returned...
void RegisterGuid(Guid guid, object obj)
Register the given Guid to the given object. If a Guid is already associated to this object...