sf::Selector< Type > Class Template Reference

Selector allow reading from multiple sockets without blocking. More...

#include <Selector.hpp>

Inheritance diagram for sf::Selector< Type >:
sf::SelectorBase

List of all members.

Public Member Functions

void Add (Type socket)
 Add a socket to watch.
void Remove (Type socket)
 Remove a socket.
void Clear ()
 Remove all sockets.
unsigned int Wait (float timeout=0.f)
 Wait and collect sockets which are ready for reading.
Type GetSocketReady (unsigned int index) const
 After a call to Wait(), get the Index-th socket which is ready for reading.

Private Member Functions

void Add (SocketHelper::SocketType socket)
 Add a socket to watch.
void Remove (SocketHelper::SocketType socket)
 Remove a socket.

Detailed Description

template<typename Type>
class sf::Selector< Type >

Selector allow reading from multiple sockets without blocking.

It's a kind of multiplexer

Definition at line 44 of file Selector.hpp.


Member Function Documentation

template<typename Type >
void sf::Selector< Type >::Add ( Type  socket  ) 

Add a socket to watch.

Parameters:
socket : Socket to add
template<typename Type >
void sf::Selector< Type >::Clear (  ) 

Remove all sockets.

Reimplemented from sf::SelectorBase.

template<typename Type >
Type sf::Selector< Type >::GetSocketReady ( unsigned int  index  )  const

After a call to Wait(), get the Index-th socket which is ready for reading.

The total number of sockets ready is the integer returned by the previous call to Wait()

Parameters:
index : Index of the socket to get
Returns:
The index-th socket

Reimplemented from sf::SelectorBase.

template<typename Type >
void sf::Selector< Type >::Remove ( Type  socket  ) 

Remove a socket.

Parameters:
socket : Socket to remove
template<typename Type >
unsigned int sf::Selector< Type >::Wait ( float  timeout = 0.f  ) 

Wait and collect sockets which are ready for reading.

This functions will return either when at least one socket is ready, or when the given time is out

Parameters:
timeout : Timeout, in seconds (0 by default : no timeout)
Returns:
Number of sockets ready to be read

Reimplemented from sf::SelectorBase.


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