1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2008 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.Text;
|
---|
25 | using System.Threading;
|
---|
26 | using HeuristicLab.Common;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Core {
|
---|
29 | /// <summary>
|
---|
30 | /// Interface to represent one run. (An engine is an interpreter, holding the code,
|
---|
31 | /// the data and the actual state, which is the runtime stack and a pointer onto the next operation.).
|
---|
32 | /// It is responsible for operator execution and able to deal with parallelism.
|
---|
33 | /// </summary>
|
---|
34 | public interface IEngine : IItem {
|
---|
35 | /// <summary>
|
---|
36 | /// Gets the operator graph of the current instance.
|
---|
37 | /// </summary>
|
---|
38 | IOperatorGraph OperatorGraph { get; }
|
---|
39 | /// <summary>
|
---|
40 | /// Gets the global scope of the current instance.
|
---|
41 | /// </summary>
|
---|
42 | IScope GlobalScope { get; }
|
---|
43 |
|
---|
44 | /// <summary>
|
---|
45 | /// Gets the execution time of the current instance.
|
---|
46 | /// </summary>
|
---|
47 | TimeSpan ExecutionTime { get; }
|
---|
48 | /// <summary>
|
---|
49 | /// Gets or sets the thread priority of the worker thread.
|
---|
50 | /// </summary>
|
---|
51 | ThreadPriority Priority { get; set; }
|
---|
52 |
|
---|
53 | /// <summary>
|
---|
54 | /// Gets information whether the engine is currently running.
|
---|
55 | /// </summary>
|
---|
56 | bool Running { get; }
|
---|
57 | /// <summary>
|
---|
58 | /// Gets information whether the engine is canceled.
|
---|
59 | /// </summary>
|
---|
60 | bool Canceled { get; }
|
---|
61 | /// <summary>
|
---|
62 | /// Gets information whether the engine has already terminated.
|
---|
63 | /// </summary>
|
---|
64 | bool Terminated { get; }
|
---|
65 |
|
---|
66 | /// <summary>
|
---|
67 | /// Executes the whole run.
|
---|
68 | /// </summary>
|
---|
69 | void Execute();
|
---|
70 | /// <summary>
|
---|
71 | /// Executes one step (one operation).
|
---|
72 | /// </summary>
|
---|
73 | void ExecuteStep();
|
---|
74 | /// <summary>
|
---|
75 | /// Executes the given number of steps.
|
---|
76 | /// </summary>
|
---|
77 | /// <param name="steps">The number of steps to execute.</param>
|
---|
78 | void ExecuteSteps(int steps);
|
---|
79 | /// <summary>
|
---|
80 | /// Aborts the engine run.
|
---|
81 | /// </summary>
|
---|
82 | void Abort();
|
---|
83 | /// <summary>
|
---|
84 | /// Resets the current instance.
|
---|
85 | /// </summary>
|
---|
86 | void Reset();
|
---|
87 |
|
---|
88 | /// <summary>
|
---|
89 | /// Occurs when the current instance is initialized.
|
---|
90 | /// </summary>
|
---|
91 | event EventHandler Initialized;
|
---|
92 | /// <summary>
|
---|
93 | /// Occurs when an operation is executed.
|
---|
94 | /// </summary>
|
---|
95 | event EventHandler<EventArgs<IOperation>> OperationExecuted;
|
---|
96 | /// <summary>
|
---|
97 | /// Occurs when an exception was thrown.
|
---|
98 | /// </summary>
|
---|
99 | event EventHandler<EventArgs<Exception>> ExceptionOccurred;
|
---|
100 | /// <summary>
|
---|
101 | /// Occurs when the execution time was changed.
|
---|
102 | /// </summary>
|
---|
103 | event EventHandler ExecutionTimeChanged;
|
---|
104 | /// <summary>
|
---|
105 | /// Occurs when the engine is finished.
|
---|
106 | /// </summary>
|
---|
107 | event EventHandler Finished;
|
---|
108 | }
|
---|
109 | }
|
---|