Added an AsyncStarted event to the progression class, currently disabled for further consideration; set up the outline of a new spatial partitioning framework with an R*-Tree implementation; new AbortedException for indicating that a process was forcefully aborted

git-svn-id: file:///srv/devel/repo-conversion/nusu@31 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2007-07-01 19:27:40 +00:00
parent 6d79fe3ebc
commit 1ae0c7de63
13 changed files with 511 additions and 30 deletions

View file

@ -0,0 +1,56 @@
#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2007 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
namespace Nuclex.Support.Scheduling {
/// <summary>Indicates that an operation has been forcefully aborted</summary>
/// <remarks>
/// This exception is the typical result of using AsyncAbort() on a running
/// background process.
/// </remarks>
[Serializable]
public class AbortedException : ApplicationException {
/// <summary>Initializes the exception</summary>
public AbortedException() { }
/// <summary>Initializes the exception with an error message</summary>
/// <param name="message">Error message describing the cause of the exception</param>
public AbortedException(string message) : base(message) { }
/// <summary>Initializes the exception as a followup exception</summary>
/// <param name="message">Error message describing the cause of the exception</param>
/// <param name="inner">Preceding exception that has caused this exception</param>
public AbortedException(string message, Exception inner) : base(message, inner) { }
/// <summary>Initializes the exception from its serialized state</summary>
/// <param name="info">Contains the serialized fields of the exception</param>
/// <param name="context">Additional environmental informations</param>
protected AbortedException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context
)
: base(info, context) { }
}
} // namespace Nuclex.Support.Scheduling

View file

@ -19,16 +19,23 @@ License along with this library
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace Nuclex.Support.Tracking {
namespace Nuclex.Support.Scheduling {
/// <summary>Interface for abortable processes</summary>
public interface IAbortable {
/// <summary>Aborts the running process. Can be called from any thread.</summary>
/// <remarks>
/// The receive should honor the abort request and stop whatever it is
/// doing as soon as possible. The method does not impose any requirement
/// on the timeliness of the reaction of the running process, but implementers
/// are advised to not ignore the abort request and try to design their code
/// in such a way that it can be stopped in a reasonable time
/// (eg. within 1 second of the abort request).
/// </remarks>
void AsyncAbort();
}
} // namespace Nuclex.Support.Tracking
} // namespace Nuclex.Support.Scheduling

View file

@ -19,24 +19,17 @@ License along with this library
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace Nuclex.Support.Tracking {
using Nuclex.Support.Tracking;
namespace Nuclex.Support.Scheduling {
/// <summary>Base class for observable operations running in the background</summary>
public abstract class Operation : Progression {
/// <summary>Executes the operation</summary>
/// <summary>Launches the background operation</summary>
public abstract void Start();
/// <summary>
/// Executes the operation synchronously, blocking the calling thread
/// </summary>
public virtual void Execute() {
Start();
WaitHandle.WaitOne();
}
}
} // namespace Nuclex.Support.Tracking
} // namespace Nuclex.Support.Scheduling

View file

@ -19,11 +19,10 @@ License along with this library
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace Nuclex.Support.Tracking {
namespace Nuclex.Support.Scheduling {
/*
public class ThreadedMethodOperation : Operation {
}
*/
} // namespace Nuclex.Support.Tracking
} // namespace Nuclex.Support.Scheduling