Abstract base class for IOperation implementations.
abstract class
|
Operation
|
extends
|
Disposable
|
||
implements
|
IOperation
|
||||
base of
|
TestOperation
|
The configurator object for this type.
public
static
property
|
Config
{
get
}
|
||
type
|
IConfigurator<IOperation>
|
||
value
|
|
The configurator object. |
Returns the configuration value that describes this object.
public
abstract
method
|
ToConfig
()
|
||
type
|
ConfigValue
|
||
returns
|
|
The configuration value. | |
implements
|
IConfigurable.ToConfig
|
Remarks:
All configurable objects need to implement this interface. For simple types, it is preferable to delegate to ToValue.
The returned value may be of type Invalid, which means that this object in its current state cannot be described with the configuration API.
Before returning the resulting configuration value, Cache must be called on it, passing this IConfigurable object as parameter.
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
Returns the human-readable name of this background operation.
public
abstract
property
|
Name
{
get
}
|
||
type
|
string
|
||
value
|
|
The name. | |
implements
|
IOperation.Name
|
Shall the background operation cancel?
public
property
|
ShallCancel
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
the
operation
shall
cancel,
false
if
not. |
||
implements
|
IOperation.ShallCancel
|
Remarks:
Once
Cancel
has
been
called,
this
property
will
return
true
.
The weight of this operation.
public
virtual
property
|
Weight
{
get
}
|
||
type
|
int32
|
||
value
|
|
The weight of this operation. | |
implements
|
IOperation.Weight
|
Remarks:
This value is only used for reporting progress when combining multiple operations.
Creates
an
MD5
checksum
(*.md5
.
like
Unix
md5sum)
for
the
given
file.
[OwnerReturn]
|
||||
public
static
method
|
Checksum
(Path file)
|
|||
type
|
IOperation
|
|||
params
|
file
|
[not-null]
|
Path to file for which to compute an MD5 checksum. | |
returns
|
|
The operation. |
Remarks:
The operation will create a new file in the same directory as file:
some_input_file.txt -> some_input_file.md5
Copies zero or more files.
[OwnerReturn]
|
||||
public
static
method
|
Copy
(Path file,
Path dir,
bool resume = false)
|
|||
type
|
IOperation
|
|||
params
|
file
|
[not-null]
|
The source file path. The last path element may contain wildcards. | |
dir
|
[not-null]
|
The target directory path. | ||
resume
|
Resume
copy
operation
if
target
file
already
exists?
Defaults
to
false .
|
|||
returns
|
|
The operation. |
Deletes zero or more existing files.
[OwnerReturn]
|
||||
public
static
method
|
Delete
(Path file)
|
|||
type
|
IOperation
|
|||
params
|
file
|
[not-null]
|
The file path. The last path element may contain wildcards. | |
returns
|
|
The operation. |
Returns an IOperation that calls Flush.
[OwnerReturn]
|
||||
public
static
method
|
Flush
(IFlushable flushable)
|
|||
type
|
IOperation
|
|||
params
|
flushable
|
[not-null]
|
The flushable object. | |
returns
|
|
The operation. |
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
Returns an IOperation object that simultaneously executes this operation and the given one.
[OwnerReturn, OwnerThis]
|
||||
public
virtual
method
|
And
([Owner]
IOperation operation)
|
|||
type
|
IOperation
|
|||
params
|
operation
|
[not-null]
|
The other operation. | |
returns
|
|
The resulting IOperation object. | ||
implements
|
IOperationOps.And
|
Requests that the running background operation gracefully terminates.
public
virtual
method
|
Cancel
()
|
||
implements
|
IOperation.Cancel
|
Remarks:
An IOperation is free to honor a cancel request or to ignore it. Cancelling a background operation should be considered as a hint to terminate as soon as possible.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Runs the operation.
public
abstract
method
|
Run
(IProgressMonitor progress)
|
||
params
|
progress
|
[not-null]
|
The progress monitor object to use. |
implements
|
IOperation.Run
|
Returns an IOperation object that executes this operation, followed by the given operation.
[OwnerReturn, OwnerThis]
|
||||
public
virtual
method
|
Then
([Owner]
IOperation operation)
|
|||
type
|
IOperation
|
|||
params
|
operation
|
[not-null]
|
The other operation. | |
returns
|
|
The resulting IOperation object. | ||
implements
|
IOperationOps.Then
|
Validates the state of this object.
public
virtual
method
|
Validate
(Validator validator)
|
||
params
|
validator
|
[not-null]
|
The validator object. |
implements
|
IValidatable.Validate
|
Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.
protected
virtual
method
|
DisposeManaged
()
|
||
inherited
|
Disposable.DisposeManaged
|
Remarks:
This method will only be called when a disposable object is explicitly destroyed by user code calling the Dispose method. It will not be called when the object is collected as garbage by the system.
Overriding methods must call the DisposeManaged method of their base class. The base call should be the last statement.
The DisposeManaged method is called before the DisposeUnmanaged method.
Disposes the unmanaged resources held by a concrete subclass. This method will be called exactly once per subclass.
protected
virtual
method
|
DisposeUnmanaged
()
|
||
inherited
|
Disposable.DisposeUnmanaged
|
Remarks:
Overriding methods must call the DisposeUnmanaged method of their base class. The base call should be the last statement.
The DisposeUnmanaged method is called after the DisposeManaged method.
Runs the given IOperation as a child of this operation.
protected
static
method
|
RunSubOperation
([Owner]
IOperation operation,
IProgressMonitor progressMonitor)
|
||
params
|
operation
|
[not-null]
|
The sub-operation to run. |
progressMonitor
|
[not-null]
|
The progress monitor to use. |
Remarks:
The given operation will be disposed after it has finished.