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