Public Member Functions | Protected Member Functions | Protected Attributes

ana::detail::timed_sender Class Reference

A network sender component that can be configured to issue timeout events. More...

#include <timers.hpp>

Inheritance diagram for ana::detail::timed_sender:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~timed_sender ()
void set_timeouts (timeout_policy type, size_t ms=0)
 Set the policy for timed operations (such as send.
template<class Handler >
void start_timer (timer *timer, shared_buffer buffer, Handler handler) const
 Start a timer given the current configuration.
bool timeouts_enabled () const
virtual timercreate_timer ()=0
 Creates a timer using the current io_service of this component.

Protected Member Functions

 timed_sender ()
 Standard constructor.

Protected Attributes

timeout_policy timeout_type_
 Type of timer policy.
size_t timeout_milliseconds_
 Amount of ms relevant to this policy.

Detailed Description

A network sender component that can be configured to issue timeout events.

Definition at line 229 of file timers.hpp.


Constructor & Destructor Documentation

virtual ana::detail::timed_sender::~timed_sender (  )  [inline, virtual]

Definition at line 233 of file timers.hpp.

ana::detail::timed_sender::timed_sender (  )  [protected]

Standard constructor.

Definition at line 123 of file asio_timers.cpp.


Member Function Documentation

virtual timer* ana::detail::timed_sender::create_timer (  )  [pure virtual]

Creates a timer using the current io_service of this component.

For efficiency reasons, always create timers this way when you have the chance.

Referenced by asio_sender::send(), asio_client::start_connection_timer(), ana_multiple_receive_handler::wait_completion(), and ana_receive_handler::wait_completion().

Here is the caller graph for this function:

void ana::detail::timed_sender::set_timeouts ( timeout_policy  type,
size_t  ms = 0 
)

Set the policy for timed operations (such as send.

)

Parameters:
type : Type of timeout policy.
ms : Milliseconds related to the given policy, 0 means no timeouts.

Examples:

  • set_timeouts( ana::NoTimeouts );
  • set_timeouts( ana::FixedTime, ana::time::minutes( 1 ) );
See also:
timeout_policy
ana::time

Definition at line 109 of file asio_timers.cpp.

References timeout_milliseconds_, and timeout_type_.

template<class Handler >
void ana::detail::timed_sender::start_timer ( timer timer,
shared_buffer  buffer,
Handler  handler 
) const [inline]

Start a timer given the current configuration.

Parameters:
buffer : The buffer used in the send operation.
handler : The handler of the timeout/abort event.
Returns:
: A pointer to a newly created timer object.

Definition at line 259 of file timers.hpp.

References timeout_milliseconds_, timeout_type_, timeouts_enabled(), ana::TimePerKilobyte, and ana::timer::wait().

Referenced by asio_sender::send().

Here is the call graph for this function:

Here is the caller graph for this function:

bool ana::detail::timed_sender::timeouts_enabled (  )  const

Definition at line 118 of file asio_timers.cpp.

References timeout_milliseconds_, and timeout_type_.

Referenced by asio_sender::send(), and start_timer().

Here is the caller graph for this function:


Member Data Documentation

Amount of ms relevant to this policy.

Definition at line 292 of file timers.hpp.

Referenced by set_timeouts(), start_timer(), and timeouts_enabled().

Type of timer policy.

Definition at line 289 of file timers.hpp.

Referenced by set_timeouts(), start_timer(), and timeouts_enabled().


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:19:18 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs