A stream inlet to receive data from a stream_outlet on the network. More...
#include <stream_inlet.h>
Public Member Functions | |
| stream_inlet (const stream_info &info) | |
| ~stream_inlet () | |
| void | open_stream () |
| void | close_stream () |
| bool | samples_available () |
| template<typename T> | |
| std::vector< std::vector< T > > | pull_chunk () |
| std::vector< std::vector< float > > | pull_chunk_float () |
A stream inlet to receive data from a stream_outlet on the network.
The stream_inlet connects to an outlet (described by a stream_info obtained from resolve_streams) over TCP and reads data from it. Data is received as chunks of multichannel float samples.
This class is API-compatible with the liblsl stream_inlet to serve as a drop-in replacement.
Definition at line 74 of file stream_inlet.h.
|
explicit |
Construct a new stream_inlet from a resolved stream_info.
| [in] | info | A stream_info object (typically obtained from resolve_streams). |
Definition at line 252 of file stream_inlet.cpp.
| stream_inlet::~stream_inlet | ( | ) |
Destructor. Closes the connection if still open.
Definition at line 259 of file stream_inlet.cpp.
| void stream_inlet::close_stream | ( | ) |
Close the TCP connection to the outlet.
Definition at line 273 of file stream_inlet.cpp.
| void stream_inlet::open_stream | ( | ) |
Open the TCP connection to the outlet and begin receiving data.
| std::runtime_error | if the connection cannot be established. |
Definition at line 266 of file stream_inlet.cpp.
|
inline |
Pull a chunk of multichannel data from the inlet.
Returns all complete samples currently in the buffer. Template is provided for API compatibility with liblsl; only float is supported in this implementation.
| T | The data type (must be float). |
Definition at line 126 of file stream_inlet.h.
| std::vector< std::vector< float > > stream_inlet::pull_chunk_float | ( | ) |
Pull a chunk of float data (non-template version).
Definition at line 287 of file stream_inlet.cpp.
| bool stream_inlet::samples_available | ( | ) |
Check whether new samples are available in the internal buffer.
Also performs a non-blocking read from the TCP socket to collect any pending data.
Definition at line 280 of file stream_inlet.cpp.