Merge pull request #19 from nspaseski/master
[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 #include <sys/select.h>
13
14 /**
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.
18 */
19
20 class Fd_Event_Handler {
21 virtual void Handle_Fd_Event(int fd,
22 boolean is_readable, boolean is_writeable, boolean is_error) = 0;
23
24 public:
25 Fd_Event_Handler() {}
26 virtual ~Fd_Event_Handler() {}
27 virtual void log() const;
28 private:
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;
33 };
34
35
36 class Handler_List;
37 class FdSets;
38
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&);
47 public:
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);
50
51 public:
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),
56 hasEvent(FALSE)
57 {}
58 virtual ~Fd_And_Timeout_Event_Handler();
59 virtual void log() const;
60
61 friend class Fd_And_Timeout_User;
62 friend class Handler_List;
63 private:
64 double callInterval, last_called;
65 Handler_List * list;
66 Fd_And_Timeout_Event_Handler * prev, * next;
67 FdSets * fdSets;
68 int fdCount;
69 boolean isTimeout, callAnyway, isPeriodic;
70 boolean hasEvent;
71 protected:
72 boolean getIsOldApi() { return fdSets != 0; }
73 };
74
75 #endif
This page took 0.048897 seconds and 6 git commands to generate.