Chops Net IP
Loading...
Searching...
No Matches
error_delivery.hpp File Reference

Functions and classes for error callback handling and basic logging. More...

#include <cstddef>
#include <utility>
#include <system_error>
#include <ostream>
#include <string>
#include <chrono>
#include "net_ip/basic_io_interface.hpp"
#include "net_ip/net_ip_error.hpp"
#include "queue/wait_queue.hpp"
Include dependency graph for error_delivery.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  chops::net::error_data
 Data provided through an error function callback. More...
 

Typedefs

using chops::net::err_wait_q = chops::wait_queue<error_data>
 wait_queue declaration that provides error data.
 

Functions

template<typename IOT >
auto chops::net::make_error_func_with_wait_queue (err_wait_q &wq)
 Create an error function object that uses a wait_queue for error data.
 
std::size_t chops::net::ostream_error_sink_with_wait_queue (err_wait_q &wq, std::ostream &os)
 A sink function that uses a wait_queue for error data and streams the data into an std::ostream.
 

Detailed Description

Functions and classes for error callback handling and basic logging.

Author
Cliff Green

Copyright (c) 2018-2019 by Cliff Green

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

Function Documentation

◆ ostream_error_sink_with_wait_queue()

std::size_t chops::net::ostream_error_sink_with_wait_queue ( err_wait_q & wq,
std::ostream & os )
inline

A sink function that uses a wait_queue for error data and streams the data into an std::ostream.

A std::cerr or std::cout or std::stringstream or similar object can be used with this function. This function exits when the wait_queue closes.

std::async can be used to invoke this function in a separate thread.

Parameters
wqA reference to a err_wait_q object.
osA reference to a std::ostream, such as std::cerr.
Returns
The total number of entries processed by the function before the queue is closed.