-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObserverEvent.h
More file actions
51 lines (38 loc) · 1.1 KB
/
Copy pathObserverEvent.h
File metadata and controls
51 lines (38 loc) · 1.1 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
#pragma once
#include"RxObserver/IncludeExtLibs.h"
#include"RxObserver/Export.h"
namespace BaseLib { namespace Concurrent
{
class ObserverAction;
FORWARD_CLASS_TRAITS(ObserverAction)
class EventResult;
FORWARD_CLASS_TRAITS(EventResult)
// ----------------------------------------------------
// ObserverEvent
// ----------------------------------------------------
/**
* ObserverEvent is provides feedback to the Subject via EventResult upon Accept, Ignore, etc.
*/
class DLL_STATE ObserverEvent : public Concurrent::Event
{
public:
ObserverEvent(EventResultPtr event, ObserverActionPtr observer);
virtual ~ObserverEvent();
CLASS_TRAITS(ObserverEvent)
virtual void Accept();
virtual void Ignore();
virtual void Filter();
virtual void Reject();
void SetResult(Templates::Any val);
template <typename Return>
Return* Result() const
{
return Templates::AnyCast<Return>(&value_);
}
private:
EventResultPtr event_;
ObserverActionPtr observer_;
Templates::Any value_;
};
typedef std::list<BaseLib::Concurrent::ObserverEvent::Ptr> ObserverEvents;
}}