libzypp 17.37.10

abstracteventsource.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* You have been warned!
12*
13*/
14#ifndef ZYPP_NG_BASE_ABSTRACTEVENTSOURCE_H_INCLUDED
15#define ZYPP_NG_BASE_ABSTRACTEVENTSOURCE_H_INCLUDED
16
17#include <zypp-core/zyppng/base/zyppglobal.h>
18#include <zypp-core/zyppng/base/Signals>
19#include <zypp-core/zyppng/base/Base>
20
21 namespace zyppng {
22
23 class EventDispatcher;
24 class AbstractEventSourcePrivate;
25
37 class LIBZYPP_NG_EXPORT AbstractEventSource : public Base
38{
39 ZYPP_DECLARE_PRIVATE(AbstractEventSource)
40 public:
41
46 enum EventTypes {
47 Read = 0x01, //< The fd is ready to read data without blocking
48 Write = 0x02, //< The fd has written pending data
49 Exception = 0x04, //< A exception has happend on the fd
50 Error = 0x08 //< There was a error polling the fd
51 };
52
53 AbstractEventSource();
54 AbstractEventSource( AbstractEventSourcePrivate &dd );
55 ~AbstractEventSource() override;
56
60 std::weak_ptr<EventDispatcher> eventDispatcher () const;
61
67 virtual void onFdReady ( int fd, int events ) = 0;
68
73 virtual void onSignal ( int signal ) = 0;
74
75 protected:
81 void updateFdWatch ( int fd, int mode );
82
87 void removeFdWatch ( int fd );
88};
89
90}
91
92#endif
zyppng::AbstractEventSourcePrivate
Definition abstracteventsource_p.h:23
zyppng::AbstractEventSource
Definition abstracteventsource.h:38
zyppng::AbstractEventSource::onSignal
virtual void onSignal(int signal)=0
zyppng::AbstractEventSource::AbstractEventSource
AbstractEventSource()
Definition abstracteventsource.cc:20
zyppng::AbstractEventSource::EventTypes
EventTypes
Definition abstracteventsource.h:46
zyppng::AbstractEventSource::Error
@ Error
Definition abstracteventsource.h:50
zyppng::AbstractEventSource::Read
@ Read
Definition abstracteventsource.h:47
zyppng::AbstractEventSource::Exception
@ Exception
Definition abstracteventsource.h:49
zyppng::AbstractEventSource::Write
@ Write
Definition abstracteventsource.h:48
zyppng::AbstractEventSource::onFdReady
virtual void onFdReady(int fd, int events)=0
zyppng::AbstractEventSource::updateFdWatch
void updateFdWatch(int fd, int mode)
Definition abstracteventsource.cc:42
zyppng::AbstractEventSource::removeFdWatch
void removeFdWatch(int fd)
Definition abstracteventsource.cc:52
zyppng::Base::Base
Base()
Definition base.cc:20
zyppng::EventDispatcher
Definition eventdispatcher.h:42
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppglobal.h
ZYPP_DECLARE_PRIVATE
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:87
LIBZYPP_NG_EXPORT
#define LIBZYPP_NG_EXPORT
Definition zyppglobal.h:8