-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimpleEvents.cpp
More file actions
37 lines (24 loc) · 825 Bytes
/
SimpleEvents.cpp
File metadata and controls
37 lines (24 loc) · 825 Bytes
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
// SimpleEvents.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "AndEvent.h"
#include "OrEvent.h"
#include "SwitchEvent.h"
using namespace SimpleEvents;
using namespace std;
int main()
{
SwitchEvent left_event;
auto h1 = left_event.add_callback([] { cout << "left event complete" << endl; });
SwitchEvent right_event;
auto h2 = right_event.add_callback([] { cout << "right event complete" << endl; });
AndEvent and_event({&left_event, &right_event });
auto h3 = and_event.add_callback([] { cout << "And event complete" << endl; });
OrEvent orr_event({ &left_event, &right_event });
auto h4 = orr_event.add_callback([] { cout << "Or event complete" << endl; });
left_event.complete();
right_event.complete();
getchar();
return 0;
}