preCICE v3.1.2
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
precice::com::SocketSendQueue Class Reference

#include <SocketSendQueue.hpp>

Collaboration diagram for precice::com::SocketSendQueue:
[legend]

Classes

struct  SendItem
 

Public Types

using Socket = boost::asio::ip::tcp::socket
 

Public Member Functions

 SocketSendQueue ()=default
 
 ~SocketSendQueue ()
 If items are left in the queue upon destruction, something went really wrong.
 
 SocketSendQueue (SocketSendQueue const &)=delete
 
SocketSendQueueoperator= (SocketSendQueue const &)=delete
 
void dispatch (std::shared_ptr< Socket > sock, boost::asio::const_buffers_1 data, std::function< void()> callback)
 Put data in the queue, start processing the queue.
 
void sendCompleted ()
 Notifies the queue that the last asynchronous send operation has completed.
 

Private Member Functions

void process ()
 This method can be called arbitrarily many times, but enough times to ensure the queue makes progress.
 

Private Attributes

std::deque< SendItem_itemQueue
 The queue, containing items to asynchronously send using boost.asio.
 
std::mutex _queueMutex {}
 The mutex protecting access to the queue.
 
bool _ready = true
 Is the queue allowed to start another asynchronous send?
 

Detailed Description

This Queue is intended for SocketCommunication to push requests which should be sent onto it. It ensures that the invocations of asio::aSend are done serially.

Definition at line 16 of file SocketSendQueue.hpp.

Member Typedef Documentation

◆ Socket

using precice::com::SocketSendQueue::Socket = boost::asio::ip::tcp::socket

Definition at line 18 of file SocketSendQueue.hpp.

Constructor & Destructor Documentation

◆ SocketSendQueue() [1/2]

precice::com::SocketSendQueue::SocketSendQueue ( )
default

◆ ~SocketSendQueue()

precice::com::SocketSendQueue::~SocketSendQueue ( )

If items are left in the queue upon destruction, something went really wrong.

Definition at line 15 of file SocketSendQueue.cpp.

◆ SocketSendQueue() [2/2]

precice::com::SocketSendQueue::SocketSendQueue ( SocketSendQueue const & )
delete

Member Function Documentation

◆ dispatch()

void precice::com::SocketSendQueue::dispatch ( std::shared_ptr< Socket > sock,
boost::asio::const_buffers_1 data,
std::function< void()> callback )

Put data in the queue, start processing the queue.

Definition at line 21 of file SocketSendQueue.cpp.

Here is the call graph for this function:

◆ operator=()

SocketSendQueue & precice::com::SocketSendQueue::operator= ( SocketSendQueue const & )
delete

◆ process()

void precice::com::SocketSendQueue::process ( )
private

This method can be called arbitrarily many times, but enough times to ensure the queue makes progress.

Definition at line 37 of file SocketSendQueue.cpp.

◆ sendCompleted()

void precice::com::SocketSendQueue::sendCompleted ( )

Notifies the queue that the last asynchronous send operation has completed.

Definition at line 30 of file SocketSendQueue.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ _itemQueue

std::deque<SendItem> precice::com::SocketSendQueue::_itemQueue
private

The queue, containing items to asynchronously send using boost.asio.

Definition at line 43 of file SocketSendQueue.hpp.

◆ _queueMutex

std::mutex precice::com::SocketSendQueue::_queueMutex {}
private

The mutex protecting access to the queue.

Definition at line 45 of file SocketSendQueue.hpp.

◆ _ready

bool precice::com::SocketSendQueue::_ready = true
private

Is the queue allowed to start another asynchronous send?

Definition at line 47 of file SocketSendQueue.hpp.


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