1 /** \file IEventOwner.cpp
2 ** \date 2005-12-07
3 ** \author grymse@alhem.net
4 **/
5 /*
6 Copyright (C) 2005-2011 Anders Hedstrom
7
8 This library is made available under the terms of the GNU GPL, with
9 the additional exemption that compiling, linking, and/or using OpenSSL
10 is allowed.
11
12 If you would like to use this library in a closed-source application,
13 a separate license agreement is available. For information about
14 the closed-source license agreement for the C++ sockets library,
15 please visit http://www.alhem.net/Sockets/license.html and/or
16 email license@alhem.net.
17
18 This program is free software; you can redistribute it and/or
19 modify it under the terms of the GNU General Public License
20 as published by the Free Software Foundation; either version 2
21 of the License, or (at your option) any later version.
22
23 This program is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 GNU General Public License for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with this program; if not, write to the Free Software
30 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 */
32 #include "IEventOwner.h"
33
34
35 #ifdef SOCKETS_NAMESPACE
36 namespace SOCKETS_NAMESPACE {
37 #endif
38
39
IEventOwner(IEventHandler & h)40 IEventOwner::IEventOwner(IEventHandler& h) : m_event_handler(h), m_handler_invalid(false)
41 {
42 }
43
44
~IEventOwner()45 IEventOwner::~IEventOwner()
46 {
47 if (!m_handler_invalid)
48 {
49 m_event_handler.ClearEvents(this);
50 }
51 }
52
53
GetEventHandler()54 IEventHandler& IEventOwner::GetEventHandler()
55 {
56 return m_event_handler;
57 }
58
59
AddEvent(long sec,long usec)60 long IEventOwner::AddEvent(long sec,long usec)
61 {
62 return m_event_handler.AddEvent(this, sec, usec);
63 }
64
65
ClearEvents()66 void IEventOwner::ClearEvents()
67 {
68 m_event_handler.ClearEvents(this);
69 }
70
71
RemoveEvent(long eid)72 void IEventOwner::RemoveEvent(long eid)
73 {
74 m_event_handler.RemoveEvent(this, eid);
75 }
76
77
78 #ifdef SOCKETS_NAMESPACE
79 }
80 #endif
81
82