RefCounted.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // RefCounted.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// Base class for intrusively reference-counted objects. These are noncopyable and non-assignable.
  21. /// </summary>
  22. public unsafe partial class RefCounted
  23. {
  24. unsafe partial void OnRefCountedCreated ();
  25. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  26. internal static extern IntPtr RefCounted_RefCounted ();
  27. [Preserve]
  28. public RefCounted ()
  29. {
  30. handle = RefCounted_RefCounted ();
  31. OnRefCountedCreated ();
  32. }
  33. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  34. internal static extern void RefCounted_AddRef (IntPtr handle);
  35. /// <summary>
  36. /// Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
  37. /// </summary>
  38. public void AddRef ()
  39. {
  40. RefCounted_AddRef (handle);
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern void RefCounted_ReleaseRef (IntPtr handle);
  44. /// <summary>
  45. /// Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
  46. /// </summary>
  47. public void ReleaseRef ()
  48. {
  49. RefCounted_ReleaseRef (handle);
  50. }
  51. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  52. internal static extern int RefCounted_Refs (IntPtr handle);
  53. /// <summary>
  54. /// Return reference count.
  55. /// </summary>
  56. public int Refs ()
  57. {
  58. return RefCounted_Refs (handle);
  59. }
  60. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  61. internal static extern int RefCounted_WeakRefs (IntPtr handle);
  62. /// <summary>
  63. /// Return weak reference count.
  64. /// </summary>
  65. public int WeakRefs ()
  66. {
  67. return RefCounted_WeakRefs (handle);
  68. }
  69. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  70. internal static extern RefCount* RefCounted_RefCountPtr (IntPtr handle);
  71. /// <summary>
  72. /// Return pointer to the reference count structure.
  73. /// </summary>
  74. public RefCount* RefCountPtr ()
  75. {
  76. return RefCounted_RefCountPtr (handle);
  77. }
  78. }
  79. }