Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IGuidContainer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 
5 namespace SiliconStudio.Quantum
6 {
7  /// <summary>
8  /// Base interface for Guid containers, object that can store a unique identifier for a collection of object.
9  /// </summary>
10  /// <remarks>Specialization of this interface will usually hold references on objects until they are unregistered or until the container is cleared.</remarks>
11  public interface IGuidContainer
12  {
13  /// <summary>
14  /// Gets or or create a <see cref="Guid"/> for a given object. If the object is <c>null</c>, a new Guid will be returned.
15  /// </summary>
16  /// <param name="obj">The object.</param>
17  /// <returns>The <see cref="Guid"/> associated to the given object, or a newly registered <see cref="Guid"/> if the object was not previously registered.</returns>
18  Guid GetOrCreateGuid(object obj);
19 
20  /// <summary>
21  /// Gets the <see cref="Guid"/> for a given object, if available.
22  /// </summary>
23  /// <param name="obj">The object.</param>
24  /// <returns>The <see cref="Guid"/> associated to the given object, or <see cref="Guid.Empty"/> if the object was not previously registered.</returns>
25  Guid GetGuid(object obj);
26 
27  /// <summary>
28  /// Register the given <see cref="Guid"/> to the given object. If a <see cref="Guid"/> is already associated to this object, it is replaced by the new one.
29  /// </summary>
30  /// <param name="guid">The <see cref="Guid"/> to register.</param>
31  /// <param name="obj">The object to register.</param>
32  void RegisterGuid(Guid guid, object obj);
33 
34  /// <summary>
35  /// Removes a <see cref="Guid"/> that was previously registered.
36  /// </summary>
37  /// <param name="guid">The <see cref="Guid"/> to remove.</param>
38  /// <returns><c>true</c> if a <see cref="Guid"/> has been actually removed, <c>false</c> otherwise.</returns>
39  bool UnregisterGuid(Guid guid);
40 
41  /// <summary>
42  /// Clear the <see cref="IGuidContainer"/>, removing everything it references.
43  /// </summary>
44  void Clear();
45  }
46 }
Base interface for Guid containers, object that can store a unique identifier for a collection of obj...