1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef EVENT_HANDLER_HH
9 #define EVENT_HANDLER_HH
12 #include <sys/select.h>
15 * The definitions in this header file are needed for TITAN.
16 * These classes should not be used in user code.
17 * These classes are used as base classes for class PORT.
20 class Fd_Event_Handler {
21 virtual void Handle_Fd_Event(int fd,
22 boolean is_readable, boolean is_writeable, boolean is_error) = 0;
26 virtual ~Fd_Event_Handler() {}
27 virtual void log() const;
29 Fd_Event_Handler(const Fd_Event_Handler&);
30 const Fd_Event_Handler & operator= (const Fd_Event_Handler &);
31 friend class Fd_And_Timeout_User;
32 friend class Handler_List;
39 class Fd_And_Timeout_Event_Handler : public Fd_Event_Handler {
40 virtual void Handle_Fd_Event(int fd,
41 boolean is_readable, boolean is_writeable, boolean is_error);
42 virtual void Handle_Timeout(double time_since_last_call);
43 /// Copy constructor disabled
44 Fd_And_Timeout_Event_Handler(const Fd_And_Timeout_Event_Handler&);
45 /// Assignment disabled
46 Fd_And_Timeout_Event_Handler& operator=(const Fd_And_Timeout_Event_Handler&);
48 virtual void Event_Handler(const fd_set *read_fds, const fd_set *write_fds,
49 const fd_set *error_fds, double time_since_last_call);
52 inline Fd_And_Timeout_Event_Handler() :
53 callInterval(0.0), last_called(0.0), list(0), prev(0), next(0),
54 fdSets(0), fdCount(0),
55 isTimeout(TRUE), callAnyway(TRUE), isPeriodic(TRUE),
58 virtual ~Fd_And_Timeout_Event_Handler();
59 virtual void log() const;
61 friend class Fd_And_Timeout_User;
62 friend class Handler_List;
64 double callInterval, last_called;
66 Fd_And_Timeout_Event_Handler * prev, * next;
69 boolean isTimeout, callAnyway, isPeriodic;
72 boolean getIsOldApi() { return fdSets != 0; }