Thrill  0.1

Detailed Description

Select is an object-oriented wrapper for select().

It takes care of the bit-fields, etc.

Definition at line 34 of file select.hpp.

#include <select.hpp>

Public Member Functions

 Select ()
 constructor More...
 
SelectClear (int fd)
 Clear a file descriptor from all sets. More...
 
SelectClearException (int fd)
 Clear a file descriptor from the exception set. More...
 
SelectClearRead (int fd)
 Clear a file descriptor from the read set. More...
 
SelectClearWrite (int fd)
 Clear a file descriptor from the write set. More...
 
bool InException (int fd) const
 Check if a file descriptor is in the resulting exception set. More...
 
bool InRead (int fd) const
 Check if a file descriptor is in the resulting read set. More...
 
bool InWrite (int fd) const
 Check if a file descriptor is in the resulting Write set. More...
 
int select (struct timeval *timeout=nullptr)
 Do a select(), which modifies the enclosed file descriptor objects. More...
 
int select_timeout (double timeout)
 Do a select() with timeout (in ms) More...
 
SelectSetException (int fd)
 Add a socket to the exception selection set. More...
 
SelectSetRead (int fd)
 Add a socket to the read and exception selection set. More...
 
SelectSetWrite (int fd)
 Add a socket to the write and exception selection set. More...
 

Private Attributes

fd_set except_set_
 exception bit-field More...
 
int max_fd_ = 0
 maximum file descriptor value in bitsets More...
 
fd_set read_set_
 read bit-field More...
 
fd_set write_set_
 write bit-field More...
 

Constructor & Destructor Documentation

◆ Select()

Select ( )
inline

constructor

Definition at line 38 of file select.hpp.

References Select::except_set_, Select::read_set_, and Select::write_set_.

Member Function Documentation

◆ Clear()

Select& Clear ( int  fd)
inline

Clear a file descriptor from all sets.

Definition at line 93 of file select.hpp.

References Select::ClearException(), Select::ClearRead(), and Select::ClearWrite().

◆ ClearException()

Select& ClearException ( int  fd)
inline

Clear a file descriptor from the exception set.

Definition at line 89 of file select.hpp.

References Select::except_set_.

Referenced by SelectDispatcher::Cancel(), Select::Clear(), and SelectDispatcher::DispatchOne().

◆ ClearRead()

Select& ClearRead ( int  fd)
inline

Clear a file descriptor from the read set.

Definition at line 81 of file select.hpp.

References Select::read_set_.

Referenced by SelectDispatcher::Cancel(), Select::Clear(), and SelectDispatcher::DispatchOne().

◆ ClearWrite()

Select& ClearWrite ( int  fd)
inline

Clear a file descriptor from the write set.

Definition at line 85 of file select.hpp.

References Select::write_set_.

Referenced by SelectDispatcher::Cancel(), Select::Clear(), and SelectDispatcher::DispatchOne().

◆ InException()

bool InException ( int  fd) const
inline

Check if a file descriptor is in the resulting exception set.

Definition at line 77 of file select.hpp.

References Select::except_set_.

Referenced by SelectDispatcher::DispatchOne().

◆ InRead()

bool InRead ( int  fd) const
inline

Check if a file descriptor is in the resulting read set.

Definition at line 69 of file select.hpp.

References Select::read_set_.

Referenced by SelectDispatcher::DispatchOne().

◆ InWrite()

bool InWrite ( int  fd) const
inline

Check if a file descriptor is in the resulting Write set.

Definition at line 73 of file select.hpp.

References Select::write_set_.

Referenced by SelectDispatcher::DispatchOne().

◆ select()

int select ( struct timeval *  timeout = nullptr)
inline

Do a select(), which modifies the enclosed file descriptor objects.

Definition at line 97 of file select.hpp.

References Select::except_set_, Select::max_fd_, Select::read_set_, and Select::write_set_.

Referenced by Select::select_timeout().

◆ select_timeout()

int select_timeout ( double  timeout)
inline

Do a select() with timeout (in ms)

Definition at line 103 of file select.hpp.

References Select::select().

Referenced by SelectDispatcher::DispatchOne().

◆ SetException()

Select& SetException ( int  fd)
inline

Add a socket to the exception selection set.

Definition at line 61 of file select.hpp.

References Select::except_set_, max(), and Select::max_fd_.

Referenced by SelectDispatcher::AddRead(), SelectDispatcher::AddWrite(), and SelectDispatcher::SetExcept().

◆ SetRead()

Select& SetRead ( int  fd)
inline

Add a socket to the read and exception selection set.

Definition at line 45 of file select.hpp.

References max(), Select::max_fd_, and Select::read_set_.

Referenced by SelectDispatcher::AddRead().

◆ SetWrite()

Select& SetWrite ( int  fd)
inline

Add a socket to the write and exception selection set.

Definition at line 53 of file select.hpp.

References max(), Select::max_fd_, and Select::write_set_.

Referenced by SelectDispatcher::AddWrite().

Member Data Documentation

◆ except_set_

fd_set except_set_
private

exception bit-field

Definition at line 123 of file select.hpp.

Referenced by Select::ClearException(), Select::InException(), Select::Select(), Select::select(), and Select::SetException().

◆ max_fd_

int max_fd_ = 0
private

maximum file descriptor value in bitsets

Definition at line 126 of file select.hpp.

Referenced by Select::select(), Select::SetException(), Select::SetRead(), and Select::SetWrite().

◆ read_set_

fd_set read_set_
private

read bit-field

Definition at line 117 of file select.hpp.

Referenced by Select::ClearRead(), Select::InRead(), Select::Select(), Select::select(), and Select::SetRead().

◆ write_set_

fd_set write_set_
private

write bit-field

Definition at line 120 of file select.hpp.

Referenced by Select::ClearWrite(), Select::InWrite(), Select::Select(), Select::select(), and Select::SetWrite().


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