annotate Implab/IPromise.cs @ 74:c4140283575c v2

minor fixes
author cin
date Mon, 08 Sep 2014 17:40:46 +0400
parents 790e8a997d30
children 4439140706d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
1 using System;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
2 using System.Collections.Generic;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
3 using System.Linq;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
4 using System.Text;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
5
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
6 namespace Implab {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
7 public interface IPromise: ICancellable {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
8 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
9 /// Check whereather the promise has no more than one dependent promise.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
10 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
11 bool IsExclusive {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
12 get;
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
13 }
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
14
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
15 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
16 /// Тип результата, получаемого через данное обещание.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
17 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
18 Type PromiseType { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
19
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
20 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
21 /// Обещание является выполненым, либо успешно, либо с ошибкой.
c4140283575c minor fixes
cin
parents: 66
diff changeset
22 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
23 bool IsResolved { get; }
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
24
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
25 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
26 /// Обещание было отменено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
27 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
28 bool IsCancelled { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
29
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
30 IPromise Then(Action success,ErrorHandler error);
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
31 IPromise Then(Action success);
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
32 IPromise Error(ErrorHandler error);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
33 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
34 /// Обрабатывает либо ошибку, либо результат. Событие отмены не обрабатывается.
c4140283575c minor fixes
cin
parents: 66
diff changeset
35 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
36 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
37 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
38 IPromise Anyway(Action handler);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
39
c4140283575c minor fixes
cin
parents: 66
diff changeset
40 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
41 /// Обрабатывает либо ошибку, либо результат, либо отмену обещания.
c4140283575c minor fixes
cin
parents: 66
diff changeset
42 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
43 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
44 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
45 IPromise Finally(Action handler);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
46 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
47 /// Обработчик для регистрации отмены обещания, событие отмены не может быть подавлено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
48 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
49 /// <returns>Новое обещание, связанное с текущим.</returns>
c4140283575c minor fixes
cin
parents: 66
diff changeset
50 /// <param name="handler">Обработчик события.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
51 /// <remarks>Если обработчик вызывает исключение, то оно передается обработчику ошибки, результат работы
c4140283575c minor fixes
cin
parents: 66
diff changeset
52 /// которого будет передан связанному обещанию</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
53 IPromise Cancelled(Action handler);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
54
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
55 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
56 /// Преобразует результат обещания к заданному типу и возвращает новое обещание.
c4140283575c minor fixes
cin
parents: 66
diff changeset
57 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
58 IPromise<T> Cast<T>();
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
59
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
60 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
61 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
62 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
63 void Join();
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
64 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
65 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
66 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
67 /// <param name="timeout">Время ожидания, по его истечению возникнет исключение.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
68 /// <exception cref="TimeoutException">Превышено время ожидания.</exception>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
69 void Join(int timeout);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
70
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
71 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
72 }