-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRxObserver.h
More file actions
62 lines (48 loc) · 1.43 KB
/
Copy pathRxObserver.h
File metadata and controls
62 lines (48 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include"RxSignal/SignalSlotBase.h"
#include"RxSignal/CommonDefines.h"
namespace BaseLib {
template <typename T>
class RxEvents
{
public:
virtual ~RxEvents()
{ }
/**
* @brief OnCompleted Notifies the Observer that the Observable has finished sending push-based notifications.
* The Observable will not call this closure if it calls onError.
*/
virtual void OnComplete() = 0;
/**
* @brief Provides the Observer with new data. The Observable calls this closure 1 or more times, unless it
* calls onError in which case this closure may never be called. The Observable will not call this closure again
* after it calls either onCompleted or onError.
*/
virtual void OnNext(T t) = 0;
/**
* @brief OnError Notifies the Observer that the Observable has experienced an error condition.
* If the Observable calls this closure, it will not thereafter call onNext or onCompleted.
*/
virtual void OnError(GeneralException exception) = 0;
};
template <typename T>
class RxObserver
: public RxEvents<T>
, public Concurrent::ObserverSlot<RxObserver<T> >
{
};
template <typename T, typename U>
class NextEvent2
{
public:
virtual ~NextEvent2()
{ }
virtual void OnNext(T t, U u) = 0;
};
template <typename T, typename U>
class NextEvent2Observer
: public NextEvent2<T, U>
, public Concurrent::ObserverSlot<NextEvent2Observer<T, U>>
{
};
}