Boost C++ Libraries Home Libraries People FAQ More

Home | Reference | Tutorial | Examples | Design
Reference Index | Class Hierarchy | Class Index | Member Index

Dispatcher Class Reference

List of all members.

Detailed Description

Dispatcher concept.

Implemented By:
boost::asio::basic_io_service
boost::asio::basic_locking_dispatcher


Public Member Functions

template<typename Handler>
void dispatch (Handler handler)
 Request the dispatcher to invoke the given handler.
template<typename Handler>
void post (Handler handler)
 Request the dispatcher to invoke the given handler and return immediately.
template<typename Handler>
unspecified wrap (Handler handler)
 Create a new handler that automatically dispatches the wrapped handler on the dispatcher.


Member Function Documentation

template<typename Handler>
void Dispatcher::dispatch ( Handler  handler  ) 

Request the dispatcher to invoke the given handler.

This function is used to ask the dispatcher to execute the given handler.

Parameters:
handler The handler to be called. The dispatcher will make a copy of the handler object as required. The equivalent function signature of the handler must be:
 void handler(); 

template<typename Handler>
void Dispatcher::post ( Handler  handler  ) 

Request the dispatcher to invoke the given handler and return immediately.

This function is used to ask the dispatcher to execute the given handler, but without allowing the dispatcher to call the handler from inside this function.

Parameters:
handler The handler to be called. The dispatcher will make a copy of the handler object as required. The equivalent function signature of the handler must be:
 void handler(); 

template<typename Handler>
unspecified Dispatcher::wrap ( Handler  handler  ) 

Create a new handler that automatically dispatches the wrapped handler on the dispatcher.

This function is used to create a new handler function object that, when invoked, will automatically pass the wrapped handler to the dispatcher's dispatch function.

Parameters:
handler The handler to be wrapped. The dispatcher will make a copy of the handler object as required. The equivalent function signature of the handler must be:
 void handler(A1 a1, ... An an); 
Returns:
A function object that, when invoked, passes the wrapped handler to the dispatcher's dispatch function. Given a function object with the signature:
 R f(A1 a1, ... An an); 
If this function object is passed to the wrap function like so:
 dispatcher.wrap(f); 
then the return value is a function object with the signature
 void g(A1 a1, ... An an); 
that, when invoked, executes code equivalent to:
 dispatcher.dispatch(boost::bind(f, a1, ... an)); 

Copyright © 2003 - 2006 Christopher M. Kohlhoff


Home | Reference | Tutorial | Examples | Design