R-Type
Networked shoot'em up built on Aegis2D
Loading...
Searching...
No Matches
rtype::ConsoleInput Class Reference

The lines typed on a stream, read on a thread of their own, for the network thread to take between two updates. More...

#include </__w/project-rtype/project-rtype/server/include/rtype/admin_console.hpp>

Public Member Functions

 ConsoleInput (std::istream &input)
 Starts reading.
 
std::vector< std::string > take ()
 The lines read since the last call.
 
bool ended () const
 Tells whether the stream ended.
 

Detailed Description

The lines typed on a stream, read on a thread of their own, for the network thread to take between two updates.

Reading blocks until a line comes, so the thread is detached and only touches the lines it shares with this object: the process may end while it waits. It ends at the end of the stream (Ctrl+D, Ctrl+Z, or a closed pipe).

Constructor & Destructor Documentation

◆ ConsoleInput()

rtype::ConsoleInput::ConsoleInput ( std::istream &  input)
explicit

Starts reading.

Parameters
inputStream to read, such as std::cin; it must outlive the reading.

Member Function Documentation

◆ ended()

bool rtype::ConsoleInput::ended ( ) const

Tells whether the stream ended.

Returns
true once every line was read. Thread-safe.

◆ take()

std::vector< std::string > rtype::ConsoleInput::take ( )

The lines read since the last call.

Returns
Them, oldest first. Thread-safe.

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