libzypp 17.37.17
|
#include <zypp-core/zyppng/base/socketnotifier.h>
Public Types | |
using | Ptr = std::shared_ptr<SocketNotifier> |
using | WeakPtr = std::weak_ptr<SocketNotifier> |
using | EventTypes = AbstractEventSource::EventTypes |
Public Types inherited from zyppng::AbstractEventSource | |
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 | |
void | setMode (int mode) |
int | mode () const |
void | setEnabled (bool enabled=true) |
int | socket () const |
SignalProxy< void(const SocketNotifier &sock, int evTypes)> | sigActivated () |
void | onFdReady (int, int events) override |
void | onSignal (int signal) override |
Public Member Functions inherited from zyppng::AbstractEventSource | |
AbstractEventSource () | |
AbstractEventSource (AbstractEventSourcePrivate &dd) | |
~AbstractEventSource () override | |
std::weak_ptr< EventDispatcher > | eventDispatcher () const |
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) |
Static Public Member Functions | |
static Ptr | create (int socket, int evTypes, bool enable=true) |
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 Member Functions | |
SocketNotifier (int socket, int evTypes) | |
Protected Member Functions inherited from zyppng::AbstractEventSource | |
void | updateFdWatch (int fd, int mode) |
void | removeFdWatch (int fd) |
Protected Member Functions inherited from zyppng::Base | |
Base (BasePrivate &dd) |
Additional Inherited Members | |
Protected Attributes inherited from zyppng::Base | |
std::unique_ptr< BasePrivate > | d_ptr |
The SocketNotifier class provides a generic way to monitor activity on a file descriptors.
Once a file descriptor was created using either low level OS API or was created by a 3rd party library, the SocketNotifier can be created to integrate the file descriptor into the event loop.
Each file descriptor can be monitored for all types of activiy supported by the base class
Definition at line 68 of file socketnotifier.h.
using zyppng::SocketNotifier::Ptr = std::shared_ptr<SocketNotifier> |
Definition at line 73 of file socketnotifier.h.
using zyppng::SocketNotifier::WeakPtr = std::weak_ptr<SocketNotifier> |
Definition at line 74 of file socketnotifier.h.
Definition at line 76 of file socketnotifier.h.
|
protected |
Definition at line 25 of file socketnotifier.cc.
|
static |
Returns a new SocketNotifier
socket | this is the filedescriptor to be modified |
evTypes | the event types that should be monitored |
enable | If set to true the notifier is enabled right away, otherwise |
Definition at line 33 of file socketnotifier.cc.
void zyppng::SocketNotifier::setMode | ( | int | mode | ) |
Update the fd watch to the mode specified.
Definition at line 40 of file socketnotifier.cc.
int zyppng::SocketNotifier::mode | ( | ) | const |
Returns the current mode used to monitor the file descriptor
Definition at line 52 of file socketnotifier.cc.
void zyppng::SocketNotifier::setEnabled | ( | bool | enabled = true | ) |
Enables or disables the SocketNotifier
Definition at line 57 of file socketnotifier.cc.
int zyppng::SocketNotifier::socket | ( | ) | const |
Returns the monitored file descriptor
Definition at line 71 of file socketnotifier.cc.
SignalProxy< void(const SocketNotifier &, int)> zyppng::SocketNotifier::sigActivated | ( | ) |
Emitted when there is activity on the socket according to the requested mode
Definition at line 76 of file socketnotifier.cc.
|
overridevirtual |
Called by the
Implements zyppng::AbstractEventSource.
Definition at line 81 of file socketnotifier.cc.
|
overridevirtual |
Called when a event source has registered to receive unix signals
Implements zyppng::AbstractEventSource.
Definition at line 86 of file socketnotifier.cc.