libzypp 17.32.5
asyncdatasource.h
Go to the documentation of this file.
1#ifndef ASYNCDATASOURCE_H
2#define ASYNCDATASOURCE_H
3
4#include <zypp-core/zyppng/base/Base>
5#include <zypp-core/zyppng/io/IODevice>
6
7namespace zyppng {
8
9 class AsyncDataSourcePrivate;
10
12 {
14 public:
15
17 RemoteClose, // the other side of the fd was closed
18 AccessError, // we got an EACCESS when polling the fd
19 InternalError, // we got a unexpected errno when polling the fd
20 UserRequest // channel were closed because close() was called
21 };
22
23 using Ptr = std::shared_ptr<AsyncDataSource>;
24 using WeakPtr = std::weak_ptr<AsyncDataSource>;
25
26 static Ptr create ();
27 bool openFds ( const std::vector<int>& readFds, int writeFd = -1 );
28 void close () override;
29
31
32 virtual void closeWriteChannel ();
33
40 bool waitForReadyRead(uint channel, int timeout) override;
41
48 void flush ();
49
56
63
67 bool readFdOpen () const;
68
72 bool readFdOpen ( uint channel ) const;
73
74 protected:
77 int64_t writeData(const char *data, int64_t count) override;
78
79 private:
80 using IODevice::open;
81
82 int64_t readData( uint channel, char *buffer, int64_t bufsize ) override;
83 int64_t rawBytesAvailable( uint channel ) const override;
84 void readChannelChanged ( uint channel ) override;
85 };
86}
87
88
89#endif // ASYNCDATASOURCE_H
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Definition AutoDispose.h:95
int64_t writeData(const char *data, int64_t count) override
SignalProxy< void(uint, AsyncDataSource::ChannelCloseReason)> sigReadFdClosed()
void readChannelChanged(uint channel) override
bool waitForReadyRead(uint channel, int timeout) override
std::weak_ptr< AsyncDataSource > WeakPtr
bool openFds(const std::vector< int > &readFds, int writeFd=-1)
int64_t readData(uint channel, char *buffer, int64_t bufsize) override
std::shared_ptr< AsyncDataSource > Ptr
ZYPP_DECLARE_PRIVATE(AsyncDataSource)
SignalProxy< void(AsyncDataSource::ChannelCloseReason)> sigWriteFdClosed()
int64_t rawBytesAvailable(uint channel) const override
bool waitForReadyRead(int timeout)
Definition iodevice.cc:315
virtual bool open(const OpenMode mode)
Definition iodevice.cc:16