BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Namespaces | Classes | Functions
fc::asio Namespace Reference

defines fc wrappers for boost::asio functions. More...

Namespaces

 detail
 internal implementation types/methods for fc::asio
 
 tcp
 
 udp
 

Classes

class  default_io_service_scope
 
class  istream
 
class  ostream
 

Functions

boost::asio::io_service & default_io_service ()
 
template<typename AsyncReadStream , typename MutableBufferSequence >
size_t read (AsyncReadStream &s, const MutableBufferSequence &buf)
 wraps boost::asio::async_read More...
 
template<typename AsyncReadStream , typename MutableBufferSequence >
future< size_t > read_some (AsyncReadStream &s, const MutableBufferSequence &buf)
 
template<typename AsyncReadStream >
future< size_t > read_some (AsyncReadStream &s, char *buffer, size_t length, size_t offset=0)
 
template<typename AsyncReadStream >
future< size_t > read_some (AsyncReadStream &s, const std::shared_ptr< char > &buffer, size_t length, size_t offset)
 
template<typename AsyncReadStream , typename MutableBufferSequence >
void async_read_some (AsyncReadStream &s, const MutableBufferSequence &buf, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
void async_read_some (AsyncReadStream &s, char *buffer, size_t length, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
void async_read_some (AsyncReadStream &s, const std::shared_ptr< char > &buffer, size_t length, size_t offset, promise< size_t >::ptr completion_promise)
 
template<typename AsyncReadStream >
size_t read_some (AsyncReadStream &s, boost::asio::streambuf &buf)
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
size_t write (AsyncWriteStream &s, const ConstBufferSequence &buf)
 wraps boost::asio::async_write More...
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
future< size_t > write_some (AsyncWriteStream &s, const ConstBufferSequence &buf)
 wraps boost::asio::async_write_some More...
 
template<typename AsyncWriteStream >
future< size_t > write_some (AsyncWriteStream &s, const char *buffer, size_t length, size_t offset=0)
 
template<typename AsyncWriteStream >
future< size_t > write_some (AsyncWriteStream &s, const std::shared_ptr< const char > &buffer, size_t length, size_t offset)
 
template<typename AsyncWriteStream , typename ConstBufferSequence >
void async_write_some (AsyncWriteStream &s, const ConstBufferSequence &buf, promise< size_t >::ptr completion_promise)
 wraps boost::asio::async_write_some More...
 
template<typename AsyncWriteStream >
void async_write_some (AsyncWriteStream &s, const char *buffer, size_t length, promise< size_t >::ptr completion_promise)
 
template<typename AsyncWriteStream >
void async_write_some (AsyncWriteStream &s, const std::shared_ptr< const char > &buffer, size_t length, size_t offset, promise< size_t >::ptr completion_promise)
 

Detailed Description

defines fc wrappers for boost::asio functions.

Function Documentation

template<typename AsyncReadStream , typename MutableBufferSequence >
void fc::asio::async_read_some ( AsyncReadStream &  s,
const MutableBufferSequence &  buf,
promise< size_t >::ptr  completion_promise 
)

Definition at line 149 of file asio.hpp.

template<typename AsyncReadStream >
void fc::asio::async_read_some ( AsyncReadStream &  s,
char *  buffer,
size_t  length,
promise< size_t >::ptr  completion_promise 
)

Definition at line 155 of file asio.hpp.

template<typename AsyncReadStream >
void fc::asio::async_read_some ( AsyncReadStream &  s,
const std::shared_ptr< char > &  buffer,
size_t  length,
size_t  offset,
promise< size_t >::ptr  completion_promise 
)

Definition at line 162 of file asio.hpp.

template<typename AsyncWriteStream , typename ConstBufferSequence >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf,
promise< size_t >::ptr  completion_promise 
)

wraps boost::asio::async_write_some

Precondition
s.non_blocking() == true
Returns
the number of bytes written

Definition at line 221 of file asio.hpp.

template<typename AsyncWriteStream >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const char *  buffer,
size_t  length,
promise< size_t >::ptr  completion_promise 
)

Definition at line 226 of file asio.hpp.

template<typename AsyncWriteStream >
void fc::asio::async_write_some ( AsyncWriteStream &  s,
const std::shared_ptr< const char > &  buffer,
size_t  length,
size_t  offset,
promise< size_t >::ptr  completion_promise 
)

Definition at line 233 of file asio.hpp.

boost::asio::io_service & fc::asio::default_io_service ( )
Returns
the default boost::asio::io_service for use with fc::asio

This IO service is automatically running in its own thread to service asynchronous requests without blocking any other threads.

Definition at line 182 of file asio.cpp.

template<typename AsyncReadStream , typename MutableBufferSequence >
size_t fc::asio::read ( AsyncReadStream &  s,
const MutableBufferSequence &  buf 
)

wraps boost::asio::async_read

Precondition
s.non_blocking() == true
Returns
the number of bytes read.

Definition at line 104 of file asio.hpp.

template<typename AsyncReadStream , typename MutableBufferSequence >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
const MutableBufferSequence &  buf 
)

This method will read at least 1 byte from the stream and will cooperatively block until that byte is available or an error occurs.

If the stream is not in 'non-blocking' mode it will be put in 'non-blocking' mode it the stream supports s.non_blocking() and s.non_blocking(bool).

If in non blocking mode, the call will be synchronous avoiding heap allocs and context switching. If the sync call returns 'would block' then an promise is created and an async read is generated.

Returns
the number of bytes read.

Definition at line 123 of file asio.hpp.

template<typename AsyncReadStream >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
char *  buffer,
size_t  length,
size_t  offset = 0 
)

Definition at line 131 of file asio.hpp.

template<typename AsyncReadStream >
future<size_t> fc::asio::read_some ( AsyncReadStream &  s,
const std::shared_ptr< char > &  buffer,
size_t  length,
size_t  offset 
)

Definition at line 140 of file asio.hpp.

template<typename AsyncReadStream >
size_t fc::asio::read_some ( AsyncReadStream &  s,
boost::asio::streambuf &  buf 
)

Definition at line 169 of file asio.hpp.

template<typename AsyncWriteStream , typename ConstBufferSequence >
size_t fc::asio::write ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf 
)

wraps boost::asio::async_write

Returns
the number of bytes written

Definition at line 181 of file asio.hpp.

template<typename AsyncWriteStream , typename ConstBufferSequence >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const ConstBufferSequence &  buf 
)

wraps boost::asio::async_write_some

Precondition
s.non_blocking() == true
Returns
the number of bytes written

Definition at line 193 of file asio.hpp.

template<typename AsyncWriteStream >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const char *  buffer,
size_t  length,
size_t  offset = 0 
)

Definition at line 200 of file asio.hpp.

template<typename AsyncWriteStream >
future<size_t> fc::asio::write_some ( AsyncWriteStream &  s,
const std::shared_ptr< const char > &  buffer,
size_t  length,
size_t  offset 
)

Definition at line 208 of file asio.hpp.