Public Member Functions | Private Member Functions | Private Attributes

ana_send_handler Class Reference

To use the asynchronous library synchronously, objects of this type lock a mutex until enough calls have been made to the associated handler. More...

#include <network_manager_ana.hpp>

Inheritance diagram for ana_send_handler:
Inheritance graph
[legend]
Collaboration diagram for ana_send_handler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ana_send_handler (size_t calls=1)
 Constructs a handler object.
 ~ana_send_handler ()
 Destructor, checks that the necessary calls were made.
void wait_completion ()
 Locks current thread until all the calls are made.
const ana::error_codeerror () const

Private Member Functions

virtual void handle_send (ana::error_code, ana::net_id, ana::operation_id)
 Handle send completion event.

Private Attributes

boost::mutex mutex_
size_t target_calls_
ana::error_code error_code_

Detailed Description

To use the asynchronous library synchronously, objects of this type lock a mutex until enough calls have been made to the associated handler.

Definition at line 171 of file network_manager_ana.hpp.


Constructor & Destructor Documentation

ana_send_handler::ana_send_handler ( size_t  calls = 1  ) 

Constructs a handler object.

Parameters:
calls [optional, default 1] : The amount of calls to the handler expected.

Definition at line 36 of file network_manager_ana.cpp.

References mutex_.

ana_send_handler::~ana_send_handler (  ) 

Destructor, checks that the necessary calls were made.

Definition at line 45 of file network_manager_ana.cpp.

References mutex_, and target_calls_.


Member Function Documentation

const ana::error_code& ana_send_handler::error (  )  const [inline]

Definition at line 186 of file network_manager_ana.hpp.

References error_code_.

Referenced by ana_network_manager::create_client_and_connect(), and ana_network_manager::send_raw_data().

Here is the caller graph for this function:

void ana_send_handler::handle_send ( ana::error_code  ,
ana::net_id  ,
ana::operation_id   
) [private, virtual]

Handle send completion event.

Parameters:
error_code : Error code of the event.
net_id : ID of the client that sent the message.
See also:
error_code
net_id

Implements ana::send_handler.

Definition at line 53 of file network_manager_ana.cpp.

References error_code_, mutex_, and target_calls_.

void ana_send_handler::wait_completion (  ) 

Locks current thread until all the calls are made.

Definition at line 63 of file network_manager_ana.cpp.

References mutex_.

Referenced by ana_network_manager::create_client_and_connect(), ana_network_manager::send_all(), ana_network_manager::send_all_except(), and ana_network_manager::send_raw_data().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 196 of file network_manager_ana.hpp.

Referenced by error(), and handle_send().

boost::mutex ana_send_handler::mutex_ [private]

Definition at line 195 of file network_manager_ana.hpp.

Referenced by handle_send(), and ~ana_send_handler().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:12:48 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs