Changeset 3289 for trunk/sources/HeuristicLab.Core
- Timestamp:
- 04/09/10 01:15:16 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Core/3.3
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Engine.cs
r3288 r3289 30 30 public abstract class Engine : Executable, IEngine { 31 31 [Storable] 32 protected ILog log; 33 public ILog Log { 34 get { return log; } 35 } 36 37 [Storable] 32 38 private Stack<IOperation> executionStack; 33 39 protected Stack<IOperation> ExecutionStack { … … 41 47 protected Engine() 42 48 : base() { 49 log = new Log(); 43 50 executionStack = new Stack<IOperation>(); 51 pausePending = stopPending = false; 52 timer = new System.Timers.Timer(100); 53 timer.AutoReset = true; 54 timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); 55 } 56 [StorableConstructor] 57 protected Engine(bool deserializing) 58 : base(deserializing) { 44 59 pausePending = stopPending = false; 45 60 timer = new System.Timers.Timer(100); … … 51 66 if (ExecutionState == ExecutionState.Started) throw new InvalidOperationException(string.Format("Clone not allowed in execution state \"{0}\".", ExecutionState)); 52 67 Engine clone = (Engine)base.Clone(cloner); 68 clone.log = (ILog)cloner.Clone(log); 53 69 IOperation[] contexts = executionStack.ToArray(); 54 70 for (int i = contexts.Length - 1; i >= 0; i--) … … 71 87 OnPrepared(); 72 88 } 89 protected override void OnPrepared() { 90 Log.LogMessage("Engine prepared"); 91 base.OnPrepared(); 92 } 93 73 94 public override void Start() { 74 95 base.Start(); 75 96 ThreadPool.QueueUserWorkItem(new WaitCallback(Run), null); 76 97 } 98 protected override void OnStarted() { 99 Log.LogMessage("Engine started"); 100 base.OnStarted(); 101 } 102 77 103 public override void Pause() { 78 104 base.Pause(); 79 105 pausePending = true; 80 106 } 107 protected override void OnPaused() { 108 Log.LogMessage("Engine paused"); 109 base.OnPaused(); 110 } 111 81 112 public override void Stop() { 82 113 base.Stop(); 83 114 stopPending = true; 84 115 if (ExecutionState == ExecutionState.Paused) OnStopped(); 116 } 117 protected override void OnStopped() { 118 Log.LogMessage("Engine stopped"); 119 base.OnStopped(); 120 } 121 122 protected override void OnExceptionOccurred(Exception exception) { 123 Log.LogException(exception); 124 base.OnExceptionOccurred(exception); 85 125 } 86 126 -
trunk/sources/HeuristicLab.Core/3.3/Executable.cs
r3262 r3289 59 59 executionTime = TimeSpan.Zero; 60 60 } 61 [StorableConstructor] 62 protected Executable(bool deserializing) : base(deserializing) { } 61 63 62 64 public override IDeepCloneable Clone(Cloner cloner) { -
trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj
r3262 r3289 103 103 <Compile Include="Attributes\CreatableAttribute.cs" /> 104 104 <None Include="HeuristicLabCorePlugin.cs.frame" /> 105 <Compile Include="Log.cs" /> 105 106 <Compile Include="Executable.cs" /> 106 107 <Compile Include="ExecutionState.cs" /> 108 <Compile Include="Interfaces\ILog.cs" /> 107 109 <Compile Include="Interfaces\IExecutable.cs" /> 108 110 <Compile Include="Interfaces\IParameterizedNamedItem.cs" /> -
trunk/sources/HeuristicLab.Core/3.3/Interfaces/IEngine.cs
r3262 r3289 20 20 #endregion 21 21 22 using System;23 using HeuristicLab.Common;24 25 22 namespace HeuristicLab.Core { 26 23 public interface IEngine : IExecutable { 24 ILog Log { get; } 25 27 26 void Prepare(IOperation initialOperation); 28 27 }
Note: See TracChangeset
for help on using the changeset viewer.