Describes a particular stream on the network. More...
#include <stream_info.h>
Public Member Functions | |
| stream_info () | |
| stream_info (const std::string &name, const std::string &type, int channel_count=0, double nominal_srate=0.0, channel_format_t channel_format=cf_float32, const std::string &source_id="") | |
| stream_info (const stream_info &other)=default | |
| stream_info & | operator= (const stream_info &other)=default |
Core Stream Properties | |
| std::string | name () const |
| Name of the stream. | |
| std::string | type () const |
| Content type of the stream. | |
| int | channel_count () const |
| Number of channels. | |
| double | nominal_srate () const |
| Nominal sampling rate in Hz. 0.0 means irregular. | |
| channel_format_t | channel_format () const |
| Data format of a channel. | |
| std::string | source_id () const |
| Unique source identifier. | |
Network / Identity Properties | |
| std::string | uid () const |
| A unique identifier for this particular stream instance (auto-generated). | |
| std::string | hostname () const |
| Hostname of the machine from which the stream originates. | |
Network Endpoint (internal, set during discovery) | |
| int | data_port () const |
| TCP data port of the outlet. | |
| std::string | data_host () const |
| Host address of the outlet (IP, set from UDP sender address during discovery). | |
| void | set_data_port (int port) |
| Set the TCP data port (used internally during discovery / outlet creation). | |
| void | set_data_host (const std::string &host) |
| Set the data host (used internally during discovery). | |
Serialization (used for network discovery) | |
| std::string | to_string () const |
| Serialize stream_info into a string for network transport. | |
| static stream_info | from_string (const std::string &data) |
| Deserialize a stream_info from a network transport string. | |
Describes a particular stream on the network.
The stream_info class holds the declaration of a data stream. It describes the core properties of a stream such as its name, content type, channel count and sampling rate, as well as optional meta-data and network endpoint information.
This class is API-compatible with the liblsl stream_info to serve as a drop-in replacement.
Definition at line 81 of file stream_info.h.
| stream_info::stream_info | ( | ) |
Default constructor. Creates an empty / invalid stream_info.
Definition at line 64 of file stream_info.cpp.
| stream_info::stream_info | ( | const std::string & | name, |
| const std::string & | type, | ||
| int | channel_count = 0, | ||
| double | nominal_srate = 0.0, | ||
| channel_format_t | channel_format = cf_float32, | ||
| const std::string & | source_id = "" ) |
Construct a new stream_info object.
| [in] | name | Name of the stream (e.g. "EEG" or "MoCap"). |
| [in] | type | Content type of the stream (e.g. "EEG", "Markers"). |
| [in] | channel_count | Number of channels in the stream. |
| [in] | nominal_srate | The nominal sampling rate (Hz). Use 0.0 for irregular streams. |
| [in] | channel_format | Data format of a channel (default: cf_float32). |
| [in] | source_id | A unique identifier for the device or source that generates the stream. |
Definition at line 80 of file stream_info.cpp.
|
default |
Copy constructor.
| int stream_info::channel_count | ( | ) | const |
Number of channels.
Definition at line 115 of file stream_info.cpp.
| channel_format_t stream_info::channel_format | ( | ) | const |
Data format of a channel.
Definition at line 129 of file stream_info.cpp.
| std::string stream_info::data_host | ( | ) | const |
Host address of the outlet (IP, set from UDP sender address during discovery).
Definition at line 164 of file stream_info.cpp.
| int stream_info::data_port | ( | ) | const |
TCP data port of the outlet.
Definition at line 157 of file stream_info.cpp.
|
static |
Deserialize a stream_info from a network transport string.
Definition at line 205 of file stream_info.cpp.
| std::string stream_info::hostname | ( | ) | const |
Hostname of the machine from which the stream originates.
Definition at line 150 of file stream_info.cpp.
| std::string stream_info::name | ( | ) | const |
Name of the stream.
Definition at line 101 of file stream_info.cpp.
| double stream_info::nominal_srate | ( | ) | const |
Nominal sampling rate in Hz. 0.0 means irregular.
Definition at line 122 of file stream_info.cpp.
|
default |
Copy assignment operator.
| void stream_info::set_data_host | ( | const std::string & | host | ) |
Set the data host (used internally during discovery).
Definition at line 178 of file stream_info.cpp.
| void stream_info::set_data_port | ( | int | port | ) |
Set the TCP data port (used internally during discovery / outlet creation).
Definition at line 171 of file stream_info.cpp.
| std::string stream_info::source_id | ( | ) | const |
Unique source identifier.
Definition at line 136 of file stream_info.cpp.
| std::string stream_info::to_string | ( | ) | const |
Serialize stream_info into a string for network transport.
Definition at line 185 of file stream_info.cpp.
| std::string stream_info::type | ( | ) | const |
Content type of the stream.
Definition at line 108 of file stream_info.cpp.
| std::string stream_info::uid | ( | ) | const |
A unique identifier for this particular stream instance (auto-generated).
Definition at line 143 of file stream_info.cpp.