Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
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::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)),
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 }
static InBufferCollector & getCollector()
boost::asio::ip::udp::socket m_socket
void handle(const boost::system::error_code &error, size_t size)
boost::atomic< bool > m_paused
static const int recv_buf_size
FrameFarm *const m_farm

◆ ~InChannelHandler()

InChannelHandler::~InChannelHandler ( )
inline

Definition at line 80 of file input_channel_handler.hh.

Member Function Documentation

◆ handle()

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 }
void resize(size_t s)
char * raw()
size_t capacity() const
bool insert(CLBDataGram *datagram)
CLBDataGram * getEmptyDataGram()

◆ pause()

void InChannelHandler::pause ( )
inline

Definition at line 55 of file input_channel_handler.hh.

56 {
57 m_paused = true;
58 }

◆ cont()

void InChannelHandler::cont ( )
inline

Definition at line 60 of file input_channel_handler.hh.

61 {
62 m_paused = false;
63 }

Member Data Documentation

◆ m_socket

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

Definition at line 17 of file input_channel_handler.hh.

◆ m_buffer

CLBDataGram* InChannelHandler::m_buffer
private

Definition at line 18 of file input_channel_handler.hh.

◆ m_farm

FrameFarm* const InChannelHandler::m_farm
private

Definition at line 19 of file input_channel_handler.hh.

◆ m_paused

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

Definition at line 20 of file input_channel_handler.hh.

◆ recv_buf_size

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: