// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Utilities; using System; using System.Collections.Generic; namespace Microsoft.MixedReality.Toolkit { /// /// Interface for Mixed Reality Toolkit service registration. /// public interface IMixedRealityServiceRegistrar { #region IMixedRealityService registration /// /// Registers a service of the specified type. /// /// The interface type of the service to be registered (ex: IMixedRealityBoundarySystem). /// An instance of the service to be registered. bool RegisterService(T serviceInstance) where T : IMixedRealityService; /// /// Registers a service of the specified type. /// /// The interface type of the service to be registered (ex: IMixedRealityBoundarySystem). /// The concrete type to instantiate. /// The platform(s) on which the service is supported. /// Optional arguments used when instantiating the concrete type. /// True if the service was successfully registered, false otherwise. bool RegisterService( Type concreteType, SupportedPlatforms supportedPlatforms = (SupportedPlatforms)(-1), params object[] args) where T : IMixedRealityService; /// /// Unregisters a service of the specified type. /// /// The interface type of the service to be unregistered (ex: IMixedRealityBoundarySystem). /// The name of the service to unregister. /// True if the service was successfully unregistered, false otherwise. /// If the name argument is not specified, the first instance will be unregistered bool UnregisterService(string name = null) where T : IMixedRealityService; /// /// Unregisters a service. /// /// The interface type of the service to be unregistered (ex: IMixedRealityBoundarySystem). /// The specific service instance to unregister. /// True if the service was successfully unregistered, false otherwise. bool UnregisterService(T serviceInstance) where T : IMixedRealityService; /// /// Checks to see if a service of the specified type has been registered. /// /// The interface type of the service (ex: IMixedRealityBoundarySystem). /// The name of the service. /// True if the service is registered, false otherwise. bool IsServiceRegistered(string name = null) where T : IMixedRealityService; /// /// Gets the instance of the registered service. /// /// The interface type of the service (ex: IMixedRealityBoundarySystem). /// The name of the service. /// Indicates whether or not diagnostic logging should be performed in case of an error /// The registered service instance as the requested type. T GetService(string name = null, bool showLogs = true) where T : IMixedRealityService; /// /// Gets the collection of the registered service instances matching the requested type. /// /// The interface type of the service (ex: IMixedRealityBoundarySystem). /// Friendly name of the service. /// Read-only collection of the service instances, as the requested type. IReadOnlyList GetServices(string name = null) where T : IMixedRealityService; #endregion IMixedRealityServce registration } }