Sync with 5.4.2
[deliverable/titan.core.git] / core / Event_Handler.hh
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
10
11 #include "Types.h"
12
13 /**
14 * The definitions in this header file are needed for TITAN.
15 * These classes should not be used in user code.
16 * These classes are used as base classes for class PORT.
17 */
18
19 class Fd_Event_Handler {
20 virtual void Handle_Fd_Event(int fd,
21 boolean is_readable, boolean is_writeable, boolean is_error) = 0;
22
23 public:
24 Fd_Event_Handler() {}
25 virtual ~Fd_Event_Handler() {}
26 virtual void log() const;
27 private:
28 Fd_Event_Handler(const Fd_Event_Handler&);
29 const Fd_Event_Handler & operator= (const Fd_Event_Handler &);
30 friend class Fd_And_Timeout_User;
31 friend class Handler_List;
32 };
33
34
35 class Handler_List;
36 class FdSets;
37
38 class Fd_And_Timeout_Event_Handler : public Fd_Event_Handler {
39 virtual void Handle_Fd_Event(int fd,
40 boolean is_readable, boolean is_writeable, boolean is_error);
41 virtual void Handle_Timeout(double time_since_last_call);
42 /// Copy constructor disabled
43 Fd_And_Timeout_Event_Handler(const Fd_And_Timeout_Event_Handler&);
44 /// Assignment disabled
45 Fd_And_Timeout_Event_Handler& operator=(const Fd_And_Timeout_Event_Handler&);
46 public:
47 virtual void Event_Handler(const fd_set *read_fds, const fd_set *write_fds,
48 const fd_set *error_fds, double time_since_last_call);
49
50 public:
51 inline Fd_And_Timeout_Event_Handler() :
52 callInterval(0.0), last_called(0.0), list(0), prev(0), next(0),
53 fdSets(0), fdCount(0),
54 isTimeout(TRUE), callAnyway(TRUE), isPeriodic(TRUE),
55 hasEvent(FALSE)
56 {}
57 virtual ~Fd_And_Timeout_Event_Handler();
58 virtual void log() const;
59
60 friend class Fd_And_Timeout_User;
61 friend class Handler_List;
62 private:
63 double callInterval, last_called;
64 Handler_List * list;
65 Fd_And_Timeout_Event_Handler * prev, * next;
66 FdSets * fdSets;
67 int fdCount;
68 boolean isTimeout, callAnyway, isPeriodic;
69 boolean hasEvent;
70 protected:
71 boolean getIsOldApi() { return fdSets != 0; }
72 };
73
74 #endif
This page took 0.035089 seconds and 5 git commands to generate.