annotate Implab/IPromiseBase.cs @ 33:b255e4aeef17

removed the reference to the parent from the promise object this allows resolved promises to release parents and results they are holding. Added complete set of operations to IPromiseBase interface Subscribing to the cancellation event of the promise should not affect it's IsExclusive property More tests.
author cin
date Thu, 10 Apr 2014 02:39:29 +0400
parents 768f7deeb55b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
9bf5b23650c9 refactoring
cin
parents:
diff changeset
1 using System;
9bf5b23650c9 refactoring
cin
parents:
diff changeset
2 using System.Collections.Generic;
9bf5b23650c9 refactoring
cin
parents:
diff changeset
3 using System.Linq;
9bf5b23650c9 refactoring
cin
parents:
diff changeset
4 using System.Text;
9bf5b23650c9 refactoring
cin
parents:
diff changeset
5
9bf5b23650c9 refactoring
cin
parents:
diff changeset
6 namespace Implab {
9bf5b23650c9 refactoring
cin
parents:
diff changeset
7 public interface IPromiseBase: ICancellable {
9bf5b23650c9 refactoring
cin
parents:
diff changeset
8 /// <summary>
9bf5b23650c9 refactoring
cin
parents:
diff changeset
9 /// Check whereather the promise has no more than one dependent promise.
9bf5b23650c9 refactoring
cin
parents:
diff changeset
10 /// </summary>
9bf5b23650c9 refactoring
cin
parents:
diff changeset
11 bool IsExclusive {
9bf5b23650c9 refactoring
cin
parents:
diff changeset
12 get;
9bf5b23650c9 refactoring
cin
parents:
diff changeset
13 }
9bf5b23650c9 refactoring
cin
parents:
diff changeset
14
29
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
15 /// <summary>
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
16 /// Тип результата, получаемого через данное обещание.
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
17 /// </summary>
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
18 Type PromiseType { get; }
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
19
25
9bf5b23650c9 refactoring
cin
parents:
diff changeset
20 bool IsResolved { get; }
9bf5b23650c9 refactoring
cin
parents:
diff changeset
21
9bf5b23650c9 refactoring
cin
parents:
diff changeset
22 bool IsCancelled { get; }
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
23
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
24 IPromiseBase Then(Action success,ErrorHandler error);
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
25 IPromiseBase Then(Action success);
33
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
26 IPromiseBase Error(ErrorHandler error);
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
27 IPromiseBase Anyway(Action handler);
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
28 IPromiseBase Finally(Action handler);
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
29 IPromiseBase Cancelled(Action handler);
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
30
29
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
31 IPromise<T> Cast<T>();
768f7deeb55b Added a casting method for promises.
cin
parents: 26
diff changeset
32
33
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
33 void Join();
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
34 void Join(int timeout);
b255e4aeef17 removed the reference to the parent from the promise object this allows
cin
parents: 29
diff changeset
35
25
9bf5b23650c9 refactoring
cin
parents:
diff changeset
36 }
9bf5b23650c9 refactoring
cin
parents:
diff changeset
37 }