PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Aurora/Framework/Modules/IRegistryCore.cs

https://bitbucket.org/VirtualReality/aurora-sim
C# | 97 lines | 17 code | 10 blank | 70 comment | 0 complexity | c0ee17f0df44ef43358928afae8ba12f MD5 | raw file
  1. /*
  2. * Copyright (c) Contributors, http://aurora-sim.org/, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the Aurora-Sim Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. namespace Aurora.Framework
  30. {
  31. public interface IRegistryCore
  32. {
  33. /// <summary>
  34. /// Register a module into the registry.
  35. /// </summary>
  36. /// <typeparam name = "T"></typeparam>
  37. /// <param name = "mod"></param>
  38. void RegisterModuleInterface<T>(T mod);
  39. /// <summary>
  40. /// Add more than one module interface.
  41. /// This is usually used to copy the contents of one registry core into another
  42. /// </summary>
  43. /// <param name = "dictionary"></param>
  44. void AddModuleInterfaces(Dictionary<Type, List<object>> dictionary);
  45. /// <summary>
  46. /// Remove a module from the registry.
  47. /// </summary>
  48. /// <typeparam name = "T"></typeparam>
  49. /// <param name = "mod"></param>
  50. void UnregisterModuleInterface<T>(T mod);
  51. /// <summary>
  52. /// Add more than one module to the same interface in the registry.
  53. /// </summary>
  54. /// <typeparam name = "T"></typeparam>
  55. /// <param name = "mod"></param>
  56. void StackModuleInterface<T>(T mod);
  57. /// <summary>
  58. /// Get a module from the interface by type.
  59. /// </summary>
  60. /// <typeparam name = "T"></typeparam>
  61. /// <returns></returns>
  62. T RequestModuleInterface<T>();
  63. /// <summary>
  64. /// Try to get a module from the interface by type.
  65. /// Returns false if it could not find a module.
  66. /// </summary>
  67. /// <typeparam name = "T"></typeparam>
  68. /// <param name = "iface"></param>
  69. /// <returns></returns>
  70. bool TryRequestModuleInterface<T>(out T iface);
  71. /// <summary>
  72. /// Get all the modules for the given interface.
  73. /// </summary>
  74. /// <typeparam name = "T"></typeparam>
  75. /// <returns></returns>
  76. T[] RequestModuleInterfaces<T>();
  77. /// <summary>
  78. /// Get all the modules in the registry.
  79. /// </summary>
  80. /// <returns></returns>
  81. Dictionary<Type, List<object>> GetInterfaces();
  82. /// <summary>
  83. /// Removes all interfaces from the registry
  84. /// </summary>
  85. void RemoveAllInterfaces();
  86. }
  87. }