libzypp  17.34.1
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 
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 
38 {
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 
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
#define ZYPP_DECLARE_PRIVATE(Class)
Definition: zyppglobal.h:86
Base class for Exception.
Definition: Exception.h:146
#define LIBZYPP_NG_EXPORT
Definition: zyppglobal.h:7