Core/System/event.h

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2011 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib may link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00031 
00032 
00033 #pragma once
00034 
00035 
00036 #include "../api_core.h"
00037 #include "sharedptr.h"
00038 #include "mutex.h"
00039 #include <vector>
00040 
00041 class CL_EventProvider;
00042 class CL_Event_Impl;
00043 
00047 class CL_API_CORE CL_Event
00048 {
00051 
00052 public:
00054         CL_Event(bool manual_reset = true, bool initial_state = false);
00055 
00056         CL_Event(CL_EventProvider *event_provider);
00057 
00058         ~CL_Event();
00059 
00060 
00064 
00065 public:
00067         CL_EventProvider *get_event_provider() const;
00068 
00069 
00073 
00074 public:
00078         bool wait(int timeout = -1);
00079 
00080         static int wait(int count, CL_Event const * const * events, int timeout = -1);
00081 
00082         static int wait(const std::vector<CL_Event *> &events, int timeout = -1);
00083 
00084         static int wait(const std::vector<CL_Event> &events, int timeout = -1);
00085 
00086         static int wait(CL_Event &event1, int timeout = -1);
00087 
00088         static int wait(CL_Event &event1, CL_Event &event2, int timeout = -1);
00089 
00090         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, int timeout = -1);
00091 
00092         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, CL_Event &event4, int timeout = -1);
00093 
00094         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, CL_Event &event4, CL_Event &event5, int timeout = -1);
00095 
00096         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, CL_Event &event4, CL_Event &event5, CL_Event &event6, int timeout = -1);
00097 
00098         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, CL_Event &event4, CL_Event &event5, CL_Event &event6, CL_Event &event7, int timeout = -1);
00099 
00100         static int wait(CL_Event &event1, CL_Event &event2, CL_Event &event3, CL_Event &event4, CL_Event &event5, CL_Event &event6, CL_Event &event7, CL_Event &event8, int timeout = -1);
00101 
00103         void set();
00104 
00106         void reset();
00107 
00108 
00112 
00113 private:
00114         CL_SharedPtr<CL_Event_Impl> impl;
00115 
00117 };
00118 
00119