A representative of a network component to the application. More...
#include <network_manager_ana.hpp>

Public Member Functions | |
| ana_component () | |
| Constructs a server component. | |
| ~ana_component () | |
| ana_component (const std::string &host, const std::string &port) | |
| Constructs a client component. | |
| network::statistics | get_send_stats () const |
| Get network upload statistics for this component. | |
| network::statistics | get_receive_stats () const |
| Get network download statistics for this component. | |
| ana::server * | server () const |
| Get the pointer to an ana::server object for this component. | |
| ana::client * | client () const |
| Get the pointer to an ana::client object for this component. | |
| ana::detail::listener * | listener () const |
| Get the pointer to an ana::listener object for this component. | |
| bool | is_server () const |
| Returns true iff this component is a server. | |
| bool | is_client () const |
| Returns true iff this component is a client. | |
| ana::net_id | get_id () const |
| Returns this component's id. | |
| network::connection | get_wesnoth_id () const |
| void | set_wesnoth_id (network::connection) |
| const ana::stats * | get_stats (ana::stat_type type=ana::ACCUMULATED) const |
| Returns a pointer to the ana::stats object for accumulated network stats. | |
| void | add_buffer (ana::read_buffer buffer, ana::net_id id) |
| Push a buffer to the queue of incoming messages. | |
| ana::read_buffer | wait_for_element () |
| Blocking operation to wait for a message in a component. | |
| network::connection | oldest_sender_id_still_pending () |
| Returns the network id of the oldest sender of a pending buffer. | |
| bool | new_buffer_ready () |
| Returns true iff. | |
Private Attributes | |
| boost::variant< ana::server *, ana::client * > | base_ |
| bool | is_server_ |
| ana::net_id | id_ |
| network::connection | wesnoth_id_ |
| boost::mutex | mutex_ |
| boost::condition_variable | condition_ |
| std::queue< ana::read_buffer > | buffers_ |
| std::queue< network::connection > | sender_ids_ |
A representative of a network component to the application.
Definition at line 36 of file network_manager_ana.hpp.
| ana_component::ana_component | ( | ) |
Constructs a server component.
Definition at line 361 of file network_manager_ana.cpp.
| ana_component::~ana_component | ( | ) |
Definition at line 385 of file network_manager_ana.cpp.
References client(), is_server(), and server().

| ana_component::ana_component | ( | const std::string & | host, | |
| const std::string & | port | |||
| ) |
Constructs a client component.
| host | : The hostname to which it is supposed to connect to. | |
| port | : The port it is supposed to connect to. |
Definition at line 373 of file network_manager_ana.cpp.
| void ana_component::add_buffer | ( | ana::read_buffer | buffer, | |
| ana::net_id | id | |||
| ) |
Push a buffer to the queue of incoming messages.
Definition at line 473 of file network_manager_ana.cpp.
References buffers_, condition_, is_server_, mutex_, and sender_ids_.
| ana::client * ana_component::client | ( | ) | const |
Get the pointer to an ana::client object for this component.
Definition at line 427 of file network_manager_ana.cpp.
References base_, and is_server_.
Referenced by ana_network_manager::create_client_and_connect(), listener(), and ~ana_component().

| ana::net_id ana_component::get_id | ( | ) | const |
Returns this component's id.
Definition at line 453 of file network_manager_ana.cpp.
References id_.
Referenced by ana_network_manager::disconnect(), ana_network_manager::get_receive_stats(), ana_network_manager::get_stats(), ana_network_manager::handle_disconnect(), ana_network_manager::handle_receive(), ana_multiple_receive_handler::handle_receive(), ana_network_manager::read_from(), ana_network_manager::run_server(), ana_network_manager::send_raw_data(), and ana_network_manager::throw_if_pending_disconnection().

| network::statistics ana_component::get_receive_stats | ( | ) | const |
Get network download statistics for this component.
Definition at line 406 of file network_manager_ana.cpp.
References ana::ACCUMULATED, network::statistics::current, network::statistics::current_max, listener(), ana::detail::ana_component::stats_collector(), and network::statistics::total.

| network::statistics ana_component::get_send_stats | ( | ) | const |
Get network upload statistics for this component.
Definition at line 393 of file network_manager_ana.cpp.
References ana::ACCUMULATED, network::statistics::current, network::statistics::current_max, listener(), ana::detail::ana_component::stats_collector(), and network::statistics::total.

| const ana::stats * ana_component::get_stats | ( | ana::stat_type | type = ana::ACCUMULATED |
) | const |
Returns a pointer to the ana::stats object for accumulated network stats.
Definition at line 468 of file network_manager_ana.cpp.
References ana::network_stats_logger::get_stats(), and listener().

| network::connection ana_component::get_wesnoth_id | ( | ) | const |
Definition at line 458 of file network_manager_ana.cpp.
References wesnoth_id_.
Referenced by ana_network_manager::disconnect(), ana_network_manager::get_send_stats(), ana_network_manager::get_stats(), ana_network_manager::read_from(), and ana_network_manager::send_raw_data().

| bool ana_component::is_client | ( | ) | const |
Returns true iff this component is a client.
Definition at line 448 of file network_manager_ana.cpp.
References is_server_.
| bool ana_component::is_server | ( | ) | const |
Returns true iff this component is a server.
Definition at line 443 of file network_manager_ana.cpp.
References is_server_.
Referenced by ~ana_component().

| ana::detail::listener * ana_component::listener | ( | ) | const |
Get the pointer to an ana::listener object for this component.
Both an ana::client an the ana::server are listeners.
Definition at line 435 of file network_manager_ana.cpp.
References client(), is_server_, and server().
Referenced by get_receive_stats(), get_send_stats(), and get_stats().


| bool ana_component::new_buffer_ready | ( | ) |
Returns true iff.
the component has a read buffer ready that hasn't been returned.
Definition at line 1343 of file network_manager_ana.cpp.
| network::connection ana_component::oldest_sender_id_still_pending | ( | ) |
Returns the network id of the oldest sender of a pending buffer.
Definition at line 499 of file network_manager_ana.cpp.
References mutex_, and sender_ids_.
| ana::server * ana_component::server | ( | ) | const |
Get the pointer to an ana::server object for this component.
Definition at line 419 of file network_manager_ana.cpp.
References base_, and is_server_.
Referenced by ana_network_manager::create_server(), listener(), and ~ana_component().

| void ana_component::set_wesnoth_id | ( | network::connection | id | ) |
Definition at line 463 of file network_manager_ana.cpp.
References wesnoth_id_.
Referenced by ana_network_manager::create_client_and_connect().

| ana::read_buffer ana_component::wait_for_element | ( | ) |
Blocking operation to wait for a message in a component.
Definition at line 485 of file network_manager_ana.cpp.
References buffers_, condition_, and mutex_.
boost::variant<ana::server*, ana::client*> ana_component::base_ [private] |
Definition at line 111 of file network_manager_ana.hpp.
std::queue< ana::read_buffer > ana_component::buffers_ [private] |
Definition at line 122 of file network_manager_ana.hpp.
Referenced by add_buffer(), new_buffer_ready(), and wait_for_element().
boost::condition_variable ana_component::condition_ [private] |
Definition at line 120 of file network_manager_ana.hpp.
Referenced by add_buffer(), and wait_for_element().
ana::net_id ana_component::id_ [private] |
Definition at line 115 of file network_manager_ana.hpp.
Referenced by get_id().
bool ana_component::is_server_ [private] |
Definition at line 113 of file network_manager_ana.hpp.
Referenced by add_buffer(), client(), is_client(), is_server(), listener(), and server().
boost::mutex ana_component::mutex_ [private] |
Definition at line 119 of file network_manager_ana.hpp.
Referenced by add_buffer(), new_buffer_ready(), oldest_sender_id_still_pending(), and wait_for_element().
std::queue< network::connection > ana_component::sender_ids_ [private] |
Definition at line 123 of file network_manager_ana.hpp.
Referenced by add_buffer(), and oldest_sender_id_still_pending().
Definition at line 116 of file network_manager_ana.hpp.
Referenced by get_wesnoth_id(), and set_wesnoth_id().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:12:41 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |