Public Member Functions | Private Member Functions | List of all members
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

Public Member Functions

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

Private Member Functions

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

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

◆ Add()

template<typename Type >
void Selector::Add ( Type  Socket)

Add a socket to watch.

Parameters
Socket: Socket to add

Definition at line 30 of file Selector.inl.

◆ Clear()

template<typename Type >
void Selector::Clear ( )

Remove all sockets.

Definition at line 59 of file Selector.inl.

◆ GetSocketReady()

template<typename Type >
Type Selector::GetSocketReady ( unsigned int  Index)

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

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

Definition at line 88 of file Selector.inl.

◆ Remove()

template<typename Type >
void Selector::Remove ( Type  Socket)

Remove a socket.

Parameters
Socket: Socket to remove

Definition at line 44 of file Selector.inl.

◆ Wait()

template<typename Type >
unsigned int Selector::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

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

Definition at line 72 of file Selector.inl.


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