1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Reflection;
|
---|
25 |
|
---|
26 | namespace HeuristicLab.PluginInfrastructure {
|
---|
27 | /// <summary>
|
---|
28 | /// Interface for application managers.
|
---|
29 | /// </summary>
|
---|
30 | public interface IApplicationManager {
|
---|
31 | /// <summary>
|
---|
32 | /// Gets all discovered plugins.
|
---|
33 | /// </summary>
|
---|
34 | IEnumerable<IPluginDescription> Plugins { get; }
|
---|
35 |
|
---|
36 | /// <summary>
|
---|
37 | /// Gets all discovered applications.
|
---|
38 | /// </summary>
|
---|
39 | IEnumerable<IApplicationDescription> Applications { get; }
|
---|
40 |
|
---|
41 | /// <summary>
|
---|
42 | /// Discovers and creates instances of <typeparamref name="T"/> and all types implementing or inheriting <typeparamref name="T"/> (directly and indirectly).
|
---|
43 | /// </summary>
|
---|
44 | /// <typeparam name="T">The type or super-type to discover.</typeparam>
|
---|
45 | /// <returns>An enumerable of instances of the discovered types.</returns>
|
---|
46 | IEnumerable<T> GetInstances<T>() where T : class;
|
---|
47 |
|
---|
48 | /// <summary>
|
---|
49 | /// Discovers and creates instances of <paramref name="type"/> and all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
|
---|
50 | /// </summary>
|
---|
51 | /// <param name="type">The type or super-type to discover.</param>
|
---|
52 | /// <returns>An enumerable of instances of the discovered types.</returns>
|
---|
53 | IEnumerable<object> GetInstances(Type type);
|
---|
54 |
|
---|
55 | /// <summary>
|
---|
56 | /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly).
|
---|
57 | /// </summary>
|
---|
58 | /// <param name="type">The type to discover.</param>
|
---|
59 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
60 | /// <returns>An enumerable of discovered types.</returns>
|
---|
61 | IEnumerable<Type> GetTypes(Type type, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
|
---|
62 |
|
---|
63 | /// <summary>
|
---|
64 | /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly).
|
---|
65 | /// </summary>
|
---|
66 | /// <param name="types">The types to discover.</param>
|
---|
67 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
68 | /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
|
---|
69 | /// <returns>An enumerable of discovered types.</returns>
|
---|
70 | IEnumerable<Type> GetTypes(IEnumerable<Type> types, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
|
---|
71 |
|
---|
72 | /// <summary>
|
---|
73 | /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>.
|
---|
74 | /// </summary>
|
---|
75 | /// <param name="type">The type to discover.</param>
|
---|
76 | /// <param name="plugin">The declaring plugin.</param>
|
---|
77 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
78 | /// <returns>An enumerable of discovered types.</returns>
|
---|
79 | IEnumerable<Type> GetTypes(Type type, IPluginDescription plugin, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
|
---|
80 |
|
---|
81 | /// <summary>
|
---|
82 | /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>.
|
---|
83 | /// </summary>
|
---|
84 | /// <param name="types">The types to discover.</param>
|
---|
85 | /// <param name="plugin">The declaring plugin.</param>
|
---|
86 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
87 | /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
|
---|
88 | /// <returns>An enumerable of discovered types.</returns>
|
---|
89 | IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
|
---|
90 |
|
---|
91 |
|
---|
92 | /// <summary>
|
---|
93 | /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in the<paramref name="assembly"/>.
|
---|
94 | /// </summary>
|
---|
95 | /// <param name="type">The type to discover.</param>
|
---|
96 | /// <param name="assembly">The declaring assembly.</param>
|
---|
97 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
98 | /// <returns>An enumerable of discovered types.</returns>
|
---|
99 | IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false);
|
---|
100 |
|
---|
101 | /// <summary>
|
---|
102 | /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declaed in any assembly of <paramref name="plugin"/>.
|
---|
103 | /// </summary>
|
---|
104 | /// <param name="types">The types to discover.</param>
|
---|
105 | /// <param name="assembly">The declaring assembly.</param>
|
---|
106 | /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param>
|
---|
107 | /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param>
|
---|
108 | /// <returns>An enumerable of discovered types.</returns>
|
---|
109 | IEnumerable<Type> GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true);
|
---|
110 |
|
---|
111 | /// <summary>
|
---|
112 | /// Finds the plugin that declares the <paramref name="type">type</paramref>.
|
---|
113 | /// </summary>
|
---|
114 | /// <param name="type">The type of interest.</param>
|
---|
115 | /// <returns>The description of the plugin that declares the given type or null if the type has not been declared by a known plugin.</returns>
|
---|
116 | IPluginDescription GetDeclaringPlugin(Type type);
|
---|
117 | }
|
---|
118 | }
|
---|