libzypp: zypp-core/ng/base/abstracteventsource.h Source File

libzypp 17.38.11

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/ng/base/zyppglobal.h>
18#include <zypp-core/ng/base/Signals>
19#include <zypp-core/ng/base/Base>
20
21namespace zyppng {
22
23class EventDispatcher;
24class AbstractEventSourcePrivate;
25
37 class AbstractEventSource : public Base
38{
39 ZYPP_DECLARE_PRIVATE(AbstractEventSource)
40public:
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
75protected:
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::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::~AbstractEventSource
~AbstractEventSource() override
Definition abstracteventsource.cc:28
zyppng::AbstractEventSource::eventDispatcher
std::weak_ptr< EventDispatcher > eventDispatcher() const
Definition abstracteventsource.cc:37
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:43
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppglobal.h
ZYPP_DECLARE_PRIVATE
#define ZYPP_DECLARE_PRIVATE(Class)
Definition zyppglobal.h:80