Public Member Functions | Private Attributes | Friends
socrob::multicast::ManagerOptions Class Reference

Options to be used when constructing the Manager. More...

#include <manager.h>

List of all members.

Public Member Functions

ManagerOptionsbandwidth_bps (std::size_t bytes_per_second)
 Sets the hard limit for bandwidth.
ManagerOptionscompressor (boost::shared_ptr< Compressor > const &compressor)
 Sets the compressor to be used.
ManagerOptionslong_marshall (buffer_function_type const &long_marshall)
 Sets the function that creates long round packets.
ManagerOptionslong_unmarshall (id_buffer_function_type const &long_unmarshall)
 Sets the function that interprets long round packets.
 ManagerOptions (uint8_t sid, uint8_t num_sids, std::string const &multicast_address)
 Constructor.
ManagerOptionsmax_lost (unsigned max_lost)
 Sets the maximum number of lost packets.
ManagerOptionsoffline_handler (id_function_type const &offline_handler)
 Sets the handler for agent deactivation event.
ManagerOptionsonline_handler (id_function_type const &online_handler)
 Sets the handler for agent activation event.
ManagerOptionsports (unsigned short long_port, unsigned short short_port)
 Sets the ports to be used.
ManagerOptionsshort_handler (handler_function_type const &short_handler)
 Sets the function that interprets short round packets.
ManagerOptionsshort_max_mine_simultaneous (std::size_t short_max_mine_simultaneous)
 Sets the maximum number of simultaneous short rounds.
ManagerOptionsshort_slot_us (unsigned short_slot_us)
 Sets the slot duration for the short rounds.
ManagerOptionsshort_wait_us (unsigned short_wait_us)
 Sets the waiting time for the short rounds.
ManagerOptionstup_ms (unsigned tup_ms)
 Sets the team update period.
ManagerOptionstup_us (unsigned tup_us)
 Sets the team update period.

Private Attributes

std::size_t bytes_per_second_
boost::shared_ptr< Compressorcompressor_
buffer_function_type long_marshall_
id_buffer_function_type long_unmarshall_
unsigned max_lost_
std::string const & multicast_address_
unsigned short multicast_long_port_
unsigned short multicast_short_port_
uint8_t num_sids_
id_function_type offline_handler_
id_function_type online_handler_
handler_function_type short_handler_
std::size_t short_max_mine_simultaneous_
unsigned short_slot_us_
unsigned short_wait_us_
uint8_t sid_
unsigned tup_us_

Friends

class Manager

Detailed Description

Options to be used when constructing the Manager.

This class is a simple container of options, to be passed to the Manager constructor to be used there.

Definition at line 47 of file manager.h.


Constructor & Destructor Documentation

socrob::multicast::ManagerOptions::ManagerOptions ( uint8_t  sid,
uint8_t  num_sids,
std::string const &  multicast_address 
) [inline]

Constructor.

The ManagerOptions constructor takes three parameters that must always be specified.

Parameters:
sidThe static ID of the agent. Must be different for all agents participating.
num_sidsThe maximum number of agents. Must be the same for all agents.
multicast_addressThe address to be used to create the multicast sockets.

Definition at line 59 of file manager.h.


Member Function Documentation

ManagerOptions& socrob::multicast::ManagerOptions::bandwidth_bps ( std::size_t  bytes_per_second) [inline]

Sets the hard limit for bandwidth.

Sets the hard limit for bandwidth. Special value 0 disables the hard limit. By default, the bandwidth is not limited.

Parameters:
bytes_per_secondMaximum bandwidth in bytes per second, 0 means unlimited.
Returns:
Reference for method chaining.

Definition at line 88 of file manager.h.

ManagerOptions& socrob::multicast::ManagerOptions::compressor ( boost::shared_ptr< Compressor > const &  compressor) [inline]

Sets the compressor to be used.

Sets the compressor to be used by both the long and the sort rounds. It must inherit from the Compressor class and be thread safe. It will automatically be used as a filter to encode all transmissions and decode all received packets. The compressor must be the same for the whole team. By default, no compression is used.

Parameters:
compressorShared pointer to the compressor.
Returns:
Reference for method chaining.

Definition at line 217 of file manager.h.

Sets the function that creates long round packets.

Sets the function responsible for creation of long round packets. This function will be called at the appropriate moment to generate a packet to be transmitted in the long rounds. Please note that this function might be called simultaneously with other functions from different threads.

Parameters:
long_marshallLong round packet creator function.
Returns:
Reference for method chaining.

Definition at line 261 of file manager.h.

Sets the function that interprets long round packets.

Sets the function responsible to interpret long round packets. This function will be called whenever a packet from any agent arrives in the long rounds. Please note that this function might be called simultaneously with other functions from different threads. Please note that this function might be called many times simultaneously.

Parameters:
long_unmarshallLong round packet interpreter function.
Returns:
Reference for method chaining.

Definition at line 277 of file manager.h.

Sets the maximum number of lost packets.

Sets the maximum number of consecutive rounds in which no packet from a given agent is received. After this number of rounds, the agent is removed from the team. By default, this is 10. Using the default team update period of 0,1 seconds, an agent will be removed from the team after 1 second of silence.

Parameters:
max_lostMaximum number of lost packets.
Returns:
Reference for method chaining.

Definition at line 151 of file manager.h.

Sets the handler for agent deactivation event.

Sets the function to be called when an agent is determined to be not running. Please note that this function might be called simultaneously with other functions from different threads.

Parameters:
offline_handlerAgent deactivation handler.
Returns:
Reference for method chaining.

Definition at line 245 of file manager.h.

Sets the handler for agent activation event.

Sets the function to be called when the first transmission from an agent is received. Please note that this function might be called simultaneously with other functions from different threads.

Parameters:
online_handlerAgent activation handler.
Returns:
Reference for method chaining.

Definition at line 231 of file manager.h.

ManagerOptions& socrob::multicast::ManagerOptions::ports ( unsigned short  long_port,
unsigned short  short_port 
) [inline]

Sets the ports to be used.

Sets the ports to be used for the multicast sockets. Two ports are necessary, one for short rounds and another for long rounds. The two ports must be different. The ports must be the same for the whole team. By default, ports 2000 and 2001 are used.

Parameters:
long_portPort to be used by the long round manager.
short_portPort to be used by the short round manager.
Returns:
Reference for method chaining.

Definition at line 104 of file manager.h.

Sets the function that interprets short round packets.

Sets the function responsible to interpret short rounds packets. This function will be called whenever a packet containing a question arrives in the short rounds. As soon as the answer is transmitted, data about the question round is deleted. Therefore, if another packet arrives with the same answer, this function will be called again. This can be a problem, depending on the question semantics. If you need to ignore duplicates, you must implement your own method. One possibility is including an identifier in the question and keep track of already answered questions, ignoring duplicates. Be careful with what happens when one agent is restarted with the system running. Using timestamps instead of identifiers might be simpler. Please note that this function might be called from inside startShortRound. Please note that this function might be called simultaneously with other functions from different threads.

Parameters:
short_handlerShort round packet interpreter function.
Returns:
Reference for method chaining.

Definition at line 303 of file manager.h.

ManagerOptions& socrob::multicast::ManagerOptions::short_max_mine_simultaneous ( std::size_t  short_max_mine_simultaneous) [inline]

Sets the maximum number of simultaneous short rounds.

Sets the maximum number of short rounds started by this agent which can be active simultaneously. If this agent keeps starting short rounds before the previous ones are resolved, after this number of rounds new attempts to start a short round will fail, ignoring the attempt. By default, the maximum number of simultaneous short rounds started by one agent is 4.

Parameters:
short_max_mine_simultaneousMaximum number of simultaneous short rounds.
Returns:
Reference for method chaining.

Definition at line 201 of file manager.h.

Sets the slot duration for the short rounds.

Sets the slot duration to be used in the short rounds, which is the maximum interval between transmissions of any agent active in a short round. This value must be the same for the whole team. By default, the slot duration is 5 milliseconds.

Parameters:
short_slot_usSlot duration in microseconds.
Returns:
Reference for method chaining.

Definition at line 166 of file manager.h.

Sets the waiting time for the short rounds.

Sets the waiting time to be used by the short rounds, which is the time that an agent waits before transmitting, after receiving a packet from the agent that was expected to transmit right before. When this happens, the slot duration is ignored. This value must be the same for the whole team. By default, the waiting time is 1 millisecond.

Parameters:
short_wait_usWaiting time in microseconds.
Returns:
Reference for method chaining.

Definition at line 183 of file manager.h.

Sets the team update period.

Sets the team update period for the agent, which is the minimum interval between transmissions of each agent (it may be enlarged due to delays). This value must be the same for the whole team. By default, the team update period is 0,1 seconds.

Parameters:
tup_msTeam update period in milliseconds.
Returns:
Reference for method chaining.

Definition at line 120 of file manager.h.

Sets the team update period.

Sets the team update period for the agent, which is the minimum interval between transmissions of each agent (it may be enlarged due to delays). This value must be the same for the whole team. By default, the team update period is 0,1 seconds.

Parameters:
tup_usTeam update period in microseconds.
Returns:
Reference for method chaining.

Definition at line 135 of file manager.h.


Friends And Related Function Documentation

friend class Manager [friend]

Definition at line 309 of file manager.h.


Member Data Documentation

Definition at line 314 of file manager.h.

Definition at line 327 of file manager.h.

Definition at line 319 of file manager.h.

Definition at line 320 of file manager.h.

Definition at line 323 of file manager.h.

Definition at line 313 of file manager.h.

Definition at line 315 of file manager.h.

Definition at line 316 of file manager.h.

Definition at line 312 of file manager.h.

Definition at line 318 of file manager.h.

Definition at line 317 of file manager.h.

Definition at line 321 of file manager.h.

Definition at line 326 of file manager.h.

Definition at line 324 of file manager.h.

Definition at line 325 of file manager.h.

Definition at line 311 of file manager.h.

Definition at line 322 of file manager.h.


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


socrob_multicast
Author(s): Joao Reis/jreis@isr.ist.utl.pt
autogenerated on Mon Jan 6 2014 11:47:49