Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
InChannelHandler Class Reference

#include <input_channel_handler.hh>

Public Member Functions

void pause ()
 
void cont ()
 
 InChannelHandler (boost::asio::io_service &service, unsigned short port, FrameFarm &farm)
 
 ~InChannelHandler ()
 

Static Public Attributes

static const int recv_buf_size = 67108864
 

Private Member Functions

void handle (const boost::system::error_code &error, size_t size)
 

Private Attributes

boost::asio::ip::udp::socket m_socket
 
CLBDataGramm_buffer
 
FrameFarm *const m_farm
 
boost::atomic< bool > m_paused
 

Detailed Description

Author
cpellegrino

Definition at line 15 of file input_channel_handler.hh.

Constructor & Destructor Documentation

InChannelHandler::InChannelHandler ( boost::asio::io_service &  service,
unsigned short  port,
FrameFarm farm 
)
inline

Definition at line 65 of file input_channel_handler.hh.

68  :
69  m_socket(service, boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), port)),
70  m_buffer(
71  InBufferCollector::getCollector().getEmptyDataGram()),
72  m_farm(&farm),
73  m_paused(false)
74  {
75  boost::asio::ip::udp::socket::receive_buffer_size option(recv_buf_size);
76  m_socket.set_option(option);
77  handle(boost::system::error_code(), 0);
78  }
boost::asio::ip::udp::socket m_socket
void handle(const boost::system::error_code &error, size_t size)
FrameFarm *const m_farm
static const int recv_buf_size
static InBufferCollector & getCollector()
boost::atomic< bool > m_paused
InChannelHandler::~InChannelHandler ( )
inline

Definition at line 80 of file input_channel_handler.hh.

81  {
83  }
void putDataGram(CLBDataGram *p)
static InBufferCollector & getCollector()

Member Function Documentation

void InChannelHandler::handle ( const boost::system::error_code &  error,
size_t  size 
)
inlineprivate

Definition at line 22 of file input_channel_handler.hh.

23  {
24  // The error_code should be handled in principle, but
25  // it is not mandatory, since all possibilities should be already
26  // handled somewhere else.
27 
28  if (size && ! m_paused)
29  {
30  m_buffer->resize(size);
32 
34  }
35 
36  m_socket.async_receive(
37  boost::asio::buffer(m_buffer->raw(), m_buffer->capacity()),
38  boost::bind(
40  this,
41  boost::asio::placeholders::error,
42  boost::asio::placeholders::bytes_transferred));
43  }
boost::asio::ip::udp::socket m_socket
size_t capacity() const
Definition: clb_datagram.hh:75
void handle(const boost::system::error_code &error, size_t size)
FrameFarm *const m_farm
void resize(size_t s)
Definition: clb_datagram.hh:54
char * raw()
Definition: clb_datagram.hh:65
bool insert(CLBDataGram *datagram)
Definition: frame_farm.cc:100
CLBDataGram * getEmptyDataGram()
static InBufferCollector & getCollector()
boost::atomic< bool > m_paused
void InChannelHandler::pause ( )
inline

Definition at line 55 of file input_channel_handler.hh.

56  {
57  m_paused = true;
58  }
boost::atomic< bool > m_paused
void InChannelHandler::cont ( )
inline

Definition at line 60 of file input_channel_handler.hh.

61  {
62  m_paused = false;
63  }
boost::atomic< bool > m_paused

Member Data Documentation

boost::asio::ip::udp::socket InChannelHandler::m_socket
private

Definition at line 17 of file input_channel_handler.hh.

CLBDataGram* InChannelHandler::m_buffer
private

Definition at line 18 of file input_channel_handler.hh.

FrameFarm* const InChannelHandler::m_farm
private

Definition at line 19 of file input_channel_handler.hh.

boost::atomic<bool> InChannelHandler::m_paused
private

Definition at line 20 of file input_channel_handler.hh.

const int InChannelHandler::recv_buf_size = 67108864
static

Definition at line 52 of file input_channel_handler.hh.


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