Add Add test::stream::lowest_layer:

This allows the stream to be used as the next layer type in
a stack of network stream layers.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2017-08-28 22:18:54 +02:00
committed by Vinnie Falco
parent 30b98674d5
commit 96c53a048f
2 changed files with 32 additions and 0 deletions

View File

@ -3,6 +3,7 @@ Version 110:
* Refactor stream open state variable
* Refactor websocket stream members
* Refactor websocket stream: fixes and tests
* Add test::stream::lowest_layer
--------------------------------------------------------------------------------

View File

@ -113,6 +113,9 @@ class stream
public:
using buffer_type = flat_buffer;
/// The type of the lowest layer.
using lowest_layer_type = stream;
/// Destructor
~stream()
{
@ -209,6 +212,34 @@ public:
return in_->ios;
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers.
*/
lowest_layer_type&
lowest_layer()
{
return *this;
}
/** Get a reference to the lowest layer
This function returns a reference to the lowest layer
in a stack of stream layers.
@return A reference to the lowest layer in the stack of
stream layers. Ownership is not transferred to the caller.
*/
lowest_layer_type const&
lowest_layer() const
{
return *this;
}
/// Set the maximum number of bytes returned by read_some
void
read_size(std::size_t n)