Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ReferenceCountingExtensions.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.Runtime.CompilerServices;
4 
5 namespace SiliconStudio.Core.ReferenceCounting
6 {
7  internal static class ReferenceCountingExtensions
8  {
9  /// <summary>
10  /// Increments the reference count of this instance.
11  /// </summary>
12  /// <returns>The method returns the new reference count.</returns>
13  [MethodImpl(MethodImplOptions.AggressiveInlining)]
14  public static int AddReferenceInternal(this IReferencable referencable)
15  {
16  return referencable.AddReference();
17  }
18 
19  /// <summary>
20  /// Decrements the reference count of this instance.
21  /// </summary>
22  /// <returns>The method returns the new reference count.</returns>
23  /// <remarks>When the reference count is going to 0, the component should release/dispose dependents objects.</remarks>
24  [MethodImpl(MethodImplOptions.AggressiveInlining)]
25  public static int ReleaseInternal(this IReferencable referencable)
26  {
27  return referencable.Release();
28  }
29  }
30 }
Base interface for all referencable objects.
Definition: IReferencable.cs:8