E-MailRelay

geventemitter.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file geventemitter.h
19///
20
21#ifndef G_NET_EVENT_EMITTER_H
22#define G_NET_EVENT_EMITTER_H
23
24#include "gdef.h"
25#include "geventhandler.h"
26#include "geventstate.h"
27
28 namespace GNet
29{
30 class EventEmitter ;
31}
32
33//| \class GNet::EventEmitter
34/// Provides static methods to raise an EventHandler event, as used
35/// by the various event loop implementations.
36///
37/// Any exceptions thrown by an event handler are caught and delivered
38/// to the associated exception handler.
39///
40/// Event loop implementations are required to keep the EventState
41/// object valid when using this interface, even if the event handler
42/// deletes the target object(s) (see EventLoop::disarm()).
43///
44 class GNet::EventEmitter
45{
46 public:
47 static void raiseReadEvent( EventHandler * , EventState & ) ;
48 ///< Calls readEvent() on the event handler and catches any
49 ///< exceptions and delivers them to the EventState exception
50 ///< handler.
51
52 static void raiseWriteEvent( EventHandler * , EventState & ) ;
53 ///< Calls writeEvent() on the event handler and catches any
54 ///< exceptions and delivers them to the EventState exception
55 ///< handler.
56
57 static void raiseOtherEvent( EventHandler * , EventState & , EventHandler::Reason ) ;
58 ///< Calls otherEvent() on the event handler and catches any
59 ///< exceptions and delivers them to the EventState exception
60 ///< handler.
61
62 public:
63 EventEmitter() = delete ;
64} ;
65
66#endif
GNet::EventEmitter
Provides static methods to raise an EventHandler event, as used by the various event loop implementat...
Definition: geventemitter.h:45
GNet::EventEmitter::raiseReadEvent
static void raiseReadEvent(EventHandler *, EventState &)
Calls readEvent() on the event handler and catches any exceptions and delivers them to the EventState...
Definition: geventemitter.cpp:84
GNet::EventEmitter::raiseOtherEvent
static void raiseOtherEvent(EventHandler *, EventState &, EventHandler::Reason)
Calls otherEvent() on the event handler and catches any exceptions and delivers them to the EventStat...
Definition: geventemitter.cpp:98
GNet::EventEmitter::raiseWriteEvent
static void raiseWriteEvent(EventHandler *, EventState &)
Calls writeEvent() on the event handler and catches any exceptions and delivers them to the EventStat...
Definition: geventemitter.cpp:91
GNet::EventHandler
A base class for classes that have a file descriptor and handle asynchronous events from the event lo...
Definition: geventhandler.h:48
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
geventhandler.h
geventstate.h
GNet
Network classes.
Definition: gdef.h:1243