Core/System/event.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 
30 
31 #pragma once
32 
33 
34 #include "../api_core.h"
35 #include "mutex.h"
36 #include <vector>
37 #include <memory>
38 
39 namespace clan
40 {
43 
44 class EventProvider;
45 class Event_Impl;
46 
48 class CL_API_CORE Event
49 {
52 
53 public:
55  Event(bool manual_reset = true, bool initial_state = false);
56 
57  Event(EventProvider *event_provider);
58 
59  ~Event();
60 
61 
65 
66 public:
68  EventProvider *get_event_provider() const;
69 
70 
74 
75 public:
79  bool wait(int timeout = -1);
80 
81  static int wait(int count, Event const * const * events, int timeout = -1);
82 
83  static int wait(const std::vector<Event *> &events, int timeout = -1);
84 
85  static int wait(const std::vector<Event> &events, int timeout = -1);
86 
87  static int wait(Event &event1, int timeout = -1);
88 
89  static int wait(Event &event1, Event &event2, int timeout = -1);
90 
91  static int wait(Event &event1, Event &event2, Event &event3, int timeout = -1);
92 
93  static int wait(Event &event1, Event &event2, Event &event3, Event &event4, int timeout = -1);
94 
95  static int wait(Event &event1, Event &event2, Event &event3, Event &event4, Event &event5, int timeout = -1);
96 
97  static int wait(Event &event1, Event &event2, Event &event3, Event &event4, Event &event5, Event &event6, int timeout = -1);
98 
99  static int wait(Event &event1, Event &event2, Event &event3, Event &event4, Event &event5, Event &event6, Event &event7, int timeout = -1);
100 
101  static int wait(Event &event1, Event &event2, Event &event3, Event &event4, Event &event5, Event &event6, Event &event7, Event &event8, int timeout = -1);
102 
104  void set();
105 
107  void reset();
108 
109 
113 
114 private:
115  std::shared_ptr<Event_Impl> impl;
116 
118 };
119 
120 
122 
123 }
OS level event provider.
Definition: event_provider.h:41
OS level event.
Definition: Core/System/event.h:48