ivi-main-loop
ivi::ChannelWatchEventSource Class Referenceabstract

This kind of source can be used to be notified whenever an event has occurred concerning a channel. More...

#include <ivi-main-loop-common.h>

Inheritance diagram for ivi::ChannelWatchEventSource:
Collaboration diagram for ivi::ChannelWatchEventSource:

Public Types

enum  Event { Event::NONE, Event::READ_AVAILABLE, Event::WRITE_AVAILABLE, Event::HANG_UP }
 
typedef std::function< ReportStatus(Event)> CallBackFunction
 
enum  ReportStatus { ReportStatus::KEEP_ENABLED, ReportStatus::DISABLE }
 

Public Member Functions

 ChannelWatchEventSource (FileDescriptor fileDescriptor, const CallBackFunction &callBackFunction)
 
virtual FileDescriptor getFileDescriptor () const
 
virtual void enable ()=0
 Enables the source. More...
 
virtual void disable ()=0
 Disables the source. More...
 
virtual bool isEnabled () const =0
 Returns true if the source is currently enabled, false otherwise. More...
 

Protected Attributes

CallBackFunction m_callBack
 
FileDescriptor m_fileDescriptor
 

Detailed Description

This kind of source can be used to be notified whenever an event has occurred concerning a channel.

The channel is typically identified by a file descriptor.

Definition at line 118 of file ivi-main-loop-common.h.

Member Enumeration Documentation

Enumerator
NONE 

No event occurred.

READ_AVAILABLE 

Some data is available from the channel.

WRITE_AVAILABLE 

Some data can be written to the channel without blocking.

HANG_UP 

The channel has been close, which means no data can be read from the corresponding file descriptor.

Definition at line 122 of file ivi-main-loop-common.h.

123  {
124  /// No event occurred
125  NONE,
126 
127  /// Some data is available from the channel
128  READ_AVAILABLE = 1,
129 
130  /// Some data can be written to the channel without blocking
131  WRITE_AVAILABLE = 2,
132 
133  /// The channel has been close, which means no data can be read from the corresponding file descriptor
134  HANG_UP = 4
135  };
enum ivi::EventSource::ReportStatus
stronginherited
Enumerator
KEEP_ENABLED 

Returning that value from a source's callback function causes the source to remain enabled.

DISABLE 

Returning that value from a source's callback function causes the source to be disabled.

Definition at line 32 of file ivi-main-loop-common.h.

33  {
34  /// Returning that value from a source's callback function causes the source to remain enabled
35  KEEP_ENABLED,
36 
37  /// Returning that value from a source's callback function causes the source to be disabled
38  DISABLE
39  };

Member Function Documentation

virtual void ivi::EventSource::enable ( )
pure virtualinherited
virtual void ivi::EventSource::disable ( )
pure virtualinherited
virtual bool ivi::EventSource::isEnabled ( ) const
pure virtualinherited

Returns true if the source is currently enabled, false otherwise.

Implemented in ivi::GLibChannelWatchEventSource, ivi::GLibTimeOutEventSource, and ivi::GLibIdleEventSource.


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