libzypp
17.32.5
|
#include <zypp-core/zyppng/io/asyncdatasource.h>
Public Types | |
enum | ChannelCloseReason { RemoteClose, AccessError, InternalError, UserRequest } |
using | Ptr = std::shared_ptr< AsyncDataSource > |
using | WeakPtr = std::weak_ptr< AsyncDataSource > |
![]() | |
enum | OpenModeFlag { Closed = 0x0, ReadOnly = 0x1, WriteOnly = 0x2, ReadWrite = ReadOnly | WriteOnly } |
using | Ptr = std::shared_ptr< IODevice > |
using | WeakPtr = std::weak_ptr< IODevice > |
![]() | |
using | Ptr = std::shared_ptr< Base > |
using | WeakPtr = std::weak_ptr< Base > |
Public Member Functions | |
bool | openFds (const std::vector< int > &readFds, int writeFd=-1) |
void | close () override |
virtual void | closeWriteChannel () |
bool | waitForReadyRead (uint channel, int timeout) override |
void | flush () |
SignalProxy< void(AsyncDataSource::ChannelCloseReason)> | sigWriteFdClosed () |
SignalProxy< void(uint, AsyncDataSource::ChannelCloseReason)> | sigReadFdClosed () |
bool | readFdOpen () const |
bool | readFdOpen (uint channel) const |
bool | waitForReadyRead (int timeout) |
virtual bool | waitForReadyRead (uint channel, int timeout)=0 |
![]() | |
ZYPP_DECLARE_FLAGS (OpenMode, OpenModeFlag) | |
IODevice () | |
void | setReadChannel (uint channel) |
uint | currentReadChannel () const |
int | readChannelCount () const |
bool | canRead () const |
bool | canWrite () const |
bool | isOpen () const |
ByteArray | readAll () |
ByteArray | read (int64_t maxSize) |
int64_t | read (char *buf, int64_t maxSize) |
virtual ByteArray | readLine (const int64_t maxSize=0) |
virtual int64_t | bytesAvailable () const |
bool | canReadLine () const |
ByteArray | readAll (uint channel) |
ByteArray | read (uint channel, int64_t maxSize) |
int64_t | read (uint channel, char *buf, int64_t maxSize) |
ByteArray | channelReadLine (uint channel, int64_t maxSize=0) |
virtual int64_t | channelReadLine (uint channel, char *buf, const int64_t maxSize) |
virtual int64_t | bytesAvailable (uint channel) const |
bool | canReadLine (uint channel) const |
int64_t | write (const ByteArray &data) |
int64_t | write (const char *data, int64_t len) |
bool | waitForReadyRead (int timeout) |
SignalProxy< void()> | sigReadyRead () |
SignalProxy< void(uint)> | sigChannelReadyRead () |
SignalProxy< void(int64_t)> | sigBytesWritten () |
SignalProxy< void()> | sigAllBytesWritten () |
![]() | |
Base () | |
virtual | ~Base () |
WeakPtr | parent () const |
void | addChild (const Base::Ptr &child) |
void | removeChild (const Ptr &child) |
const std::unordered_set< Ptr > & | children () const |
std::thread::id | threadId () const |
template<typename T > | |
std::vector< std::weak_ptr< T > > | findChildren () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () const |
template<typename T > | |
std::shared_ptr< T > | shared_this () |
template<typename T > | |
std::weak_ptr< T > | weak_this () const |
template<typename T > | |
std::weak_ptr< T > | weak_this () |
template<typename SenderFunc , typename ReceiverFunc > | |
auto | connect (SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
std::enable_if_t< std::is_member_function_pointer_v< SenderFunc >, connection > | connectFunc (SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Static Public Member Functions | |
static Ptr | create () |
![]() | |
template<typename Obj , typename Functor > | |
static decltype(auto) | make_base_slot (Obj *o, Functor &&f) |
template<typename SenderFunc , typename ReceiverFunc > | |
static auto | connect (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, typename internal::MemberFunction< ReceiverFunc >::ClassType &recv, ReceiverFunc &&rFunc) |
template<typename SenderFunc , typename ReceiverFunc , typename ... Tracker> | |
static auto | connectFunc (typename internal::MemberFunction< SenderFunc >::ClassType &s, SenderFunc &&sFun, ReceiverFunc &&rFunc, const Tracker &...trackers) |
Protected Member Functions | |
AsyncDataSource () | |
AsyncDataSource (AsyncDataSourcePrivate &d) | |
int64_t | writeData (const char *data, int64_t count) override |
![]() | |
IODevice (IODevicePrivate &d) | |
virtual bool | open (const OpenMode mode) |
void | setReadChannelCount (uint channels) |
![]() | |
Base (BasePrivate &dd) | |
Private Member Functions | |
ZYPP_DECLARE_PRIVATE (AsyncDataSource) | |
int64_t | readData (uint channel, char *buffer, int64_t bufsize) override |
int64_t | rawBytesAvailable (uint channel) const override |
void | readChannelChanged (uint channel) override |
virtual bool | open (const OpenMode mode) |
Additional Inherited Members | |
![]() | |
std::unique_ptr< BasePrivate > | d_ptr |
Definition at line 11 of file asyncdatasource.h.
using zyppng::AsyncDataSource::Ptr = std::shared_ptr<AsyncDataSource> |
Definition at line 23 of file asyncdatasource.h.
using zyppng::AsyncDataSource::WeakPtr = std::weak_ptr<AsyncDataSource> |
Definition at line 24 of file asyncdatasource.h.
Enumerator | |
---|---|
RemoteClose | |
AccessError | |
InternalError | |
UserRequest |
Definition at line 16 of file asyncdatasource.h.
|
protected |
Definition at line 137 of file asyncdatasource.cpp.
|
protected |
Definition at line 140 of file asyncdatasource.cpp.
|
private |
|
static |
Definition at line 144 of file asyncdatasource.cpp.
bool zyppng::AsyncDataSource::openFds | ( | const std::vector< int > & | readFds, |
int | writeFd = -1 |
||
) |
Definition at line 150 of file asyncdatasource.cpp.
|
overridevirtual |
Reimplemented from zyppng::IODevice.
Reimplemented in zyppng::Process.
Definition at line 258 of file asyncdatasource.cpp.
|
virtual |
Reimplemented in zyppng::Process.
Definition at line 279 of file asyncdatasource.cpp.
|
overridevirtual |
Blocks the current event loop to wait until all bytes currently in the buffer have been written to the write fd.
Implements zyppng::IODevice.
Definition at line 299 of file asyncdatasource.cpp.
void zyppng::AsyncDataSource::flush | ( | ) |
Blocks the current event loop to wait until all bytes currently in the buffer have been written to the write fd.
Definition at line 330 of file asyncdatasource.cpp.
SignalProxy< void(AsyncDataSource::ChannelCloseReason)> zyppng::AsyncDataSource::sigWriteFdClosed | ( | ) |
Signal is emitted always when the write channel is closed. All data that was not written yet will be discarded and canWrite() will return false.
Definition at line 349 of file asyncdatasource.cpp.
SignalProxy< void(uint, AsyncDataSource::ChannelCloseReason)> zyppng::AsyncDataSource::sigReadFdClosed | ( | ) |
Signal is emitted always when the write channel is closed, for example when the write side of a pipe is closed. All data still residing in the read buffer can still be read.
Definition at line 354 of file asyncdatasource.cpp.
bool zyppng::AsyncDataSource::readFdOpen | ( | ) | const |
Returns true as long as the default read channel was not closed ( e.g. sigReadFdClosed was emitted )
Definition at line 359 of file asyncdatasource.cpp.
bool zyppng::AsyncDataSource::readFdOpen | ( | uint | channel | ) | const |
Returns true as long as the given read channel was not closed ( e.g. sigReadFdClosed was emitted )
Definition at line 367 of file asyncdatasource.cpp.
|
overrideprotectedvirtual |
Implements zyppng::IODevice.
Definition at line 201 of file asyncdatasource.cpp.
|
overrideprivatevirtual |
Implements zyppng::IODevice.
Definition at line 212 of file asyncdatasource.cpp.
|
overrideprivatevirtual |
Implements zyppng::IODevice.
Definition at line 235 of file asyncdatasource.cpp.
|
overrideprivatevirtual |
Implements zyppng::IODevice.
Definition at line 249 of file asyncdatasource.cpp.
bool zyppng::IODevice::waitForReadyRead |
Blocks the current event loop to wait until there are bytes available to read from the device. This always operates on the read channel that is selected as the default when the function is first called, even if the default channel would be changed during the wait.
Definition at line 315 of file iodevice.cc.
virtual bool zyppng::IODevice::waitForReadyRead |
Blocks the current event loop to wait until there are bytes available to read from the given read channel.
|
private |
Definition at line 16 of file iodevice.cc.