libzypp 17.37.10

zyppng::AbstractEventSource Class Referenceabstract

`#include <zypp-core/zyppng/base/abstracteventsource.h>`

Inheritance diagram for zyppng::AbstractEventSource:

## Public Types
enum | EventTypes { Read = 0x01 , Write = 0x02 , Exception = 0x04 , Error = 0x08 }
Public Types inherited from zyppng::Base
using | Ptr = std::shared_ptr<Base>
using | WeakPtr = std::weak_ptr<Base>

## Public Member Functions
| AbstractEventSource ()
| AbstractEventSource (AbstractEventSourcePrivate &dd)
| ~AbstractEventSource () override
std::weak_ptr< EventDispatcher > | eventDispatcher () const
virtual void | onFdReady (int fd, int events)=0
virtual void | onSignal (int signal)=0
Public Member Functions inherited from zyppng::Base
| 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)

## Protected Member Functions
void | updateFdWatch (int fd, int mode)
void | removeFdWatch (int fd)
Protected Member Functions inherited from zyppng::Base
| Base (BasePrivate &dd)

## Additional Inherited Members
Static Public Member Functions inherited from zyppng::Base
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 Attributes inherited from zyppng::Base
std::unique_ptr< BasePrivate > | d_ptr

## Detailed Description

The AbstractEventSource class is the base class for all objects that can be tracked using one or more file descriptors

A subclass can register multiple file descriptors to be tracked using updateFdWatch and remove them with removeFdWatch. This is internally forwarded to the

See also
  EventDispatcher belonging to the AbstractEventSource.

In case there is activity on the file descriptor the EventDispatcher wakes up and forwards it to onFdReady.

Definition at line 37 of file abstracteventsource.h.

## Member Enumeration Documentation

## ◆ EventTypes

enum zyppng::AbstractEventSource::EventTypes

The different types of events a AbstractEventSource can listen for.

Enumerator
Read |
Write |
Exception |
Error |

Definition at line 46 of file abstracteventsource.h.

## Constructor & Destructor Documentation

## ◆ AbstractEventSource() [1/2]

zyppng::AbstractEventSource::AbstractEventSource | ( |  | ) |

Definition at line 20 of file abstracteventsource.cc.

## ◆ AbstractEventSource() [2/2]

zyppng::AbstractEventSource::AbstractEventSource | ( | AbstractEventSourcePrivate & | dd | ) |

Definition at line 24 of file abstracteventsource.cc.

## ◆ ~AbstractEventSource()

zyppng::AbstractEventSource::~AbstractEventSource | ( |  | ) |
| override

Definition at line 28 of file abstracteventsource.cc.

## Member Function Documentation

## ◆ eventDispatcher()

std::weak_ptr< EventDispatcher > zyppng::AbstractEventSource::eventDispatcher | ( |  | ) | const

Returns the

See also
  EventDispatcher that takes care of this event source

Definition at line 37 of file abstracteventsource.cc.

## ◆ onFdReady()

virtual void zyppng::AbstractEventSource::onFdReady | ( | int | fd,
|  | int | events )
| pure virtual

Called by the

See also
  EventDispatcher when activity was detected on a registered fd. The events are set according to the activity on the file descriptor.

Implemented in zyppng::AsyncQueueWatch, zyppng::SocketNotifier, and zyppng::UnixSignalSource.

## ◆ onSignal()

virtual void zyppng::AbstractEventSource::onSignal | ( | int | signal | ) |
| pure virtual

Called when a event source has registered to receive unix signals

Note
  this is not supported yet

Implemented in zyppng::AsyncQueueWatch, zyppng::SocketNotifier, and zyppng::UnixSignalSource.

## ◆ updateFdWatch()

void zyppng::AbstractEventSource::updateFdWatch | ( | int | fd,
|  | int | mode )
| protected

Register or update a file descriptor poll mode.

Parameters

  fd | The fd to add or update to the watchlist of the

See also
  EventDispatcher

Parameters

  mode | The watchmode used in the watchlist

See also
  EventTypes

Definition at line 42 of file abstracteventsource.cc.

## ◆ removeFdWatch()

void zyppng::AbstractEventSource::removeFdWatch | ( | int | fd | ) |
| protected

Removes the given fd from the

See also
  EventDispatcher watchlist. After calling this no more events will be received by the object it was called on.

Definition at line 52 of file abstracteventsource.cc.

The documentation for this class was generated from the following files:

- zypp-core/zyppng/base/abstracteventsource.h
- zypp-core/zyppng/base/abstracteventsource.cc