v2.0.0
Loading...
Searching...
No Matches
LSLLIB::stream_info Class Reference

Describes a particular stream on the network. More...

#include <lsl_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, ChannelFormat channel_format=ChannelFormat::Float32, const std::string &source_id="")
 stream_info (const stream_info &other)=default
stream_infooperator= (const stream_info &other)=default
Core Stream Properties
std::string name () const noexcept
 Name of the stream.
std::string type () const noexcept
 Content type of the stream.
int channel_count () const noexcept
 Number of channels.
double nominal_srate () const noexcept
 Nominal sampling rate in Hz. 0.0 means irregular.
ChannelFormat channel_format () const noexcept
 Data format of a channel.
std::string source_id () const noexcept
 Unique source identifier.
Network / Identity Properties
std::string uid () const noexcept
 A unique identifier for this particular stream instance (auto-generated).
std::string hostname () const noexcept
 Hostname of the machine from which the stream originates.
Network Endpoint (internal, set during discovery)
int data_port () const noexcept
 TCP data port of the outlet.
std::string data_host () const noexcept
 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.

Detailed Description

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 82 of file lsl_stream_info.h.

Constructor & Destructor Documentation

◆ stream_info() [1/3]

stream_info::stream_info ( )

Default constructor. Creates an empty / invalid stream_info.

Definition at line 64 of file lsl_stream_info.cpp.

◆ stream_info() [2/3]

stream_info::stream_info ( const std::string & name,
const std::string & type,
int channel_count = 0,
double nominal_srate = 0.0,
ChannelFormat channel_format = ChannelFormat::Float32,
const std::string & source_id = "" )

Construct a new stream_info object.

Parameters
[in]nameName of the stream (e.g. "EEG" or "MoCap").
[in]typeContent type of the stream (e.g. "EEG", "Markers").
[in]channel_countNumber of channels in the stream.
[in]nominal_srateThe nominal sampling rate (Hz). Use 0.0 for irregular streams.
[in]channel_formatData format of a channel (default: cf_float32).
[in]source_idA unique identifier for the device or source that generates the stream.

Definition at line 80 of file lsl_stream_info.cpp.

◆ stream_info() [3/3]

LSLLIB::stream_info::stream_info ( const stream_info & other)
default

Copy constructor.

Member Function Documentation

◆ channel_count()

int stream_info::channel_count ( ) const
nodiscardnoexcept

Number of channels.

Definition at line 115 of file lsl_stream_info.cpp.

◆ channel_format()

ChannelFormat stream_info::channel_format ( ) const
nodiscardnoexcept

Data format of a channel.

Definition at line 129 of file lsl_stream_info.cpp.

◆ data_host()

std::string stream_info::data_host ( ) const
nodiscardnoexcept

Host address of the outlet (IP, set from UDP sender address during discovery).

Definition at line 164 of file lsl_stream_info.cpp.

◆ data_port()

int stream_info::data_port ( ) const
nodiscardnoexcept

TCP data port of the outlet.

Definition at line 157 of file lsl_stream_info.cpp.

◆ from_string()

stream_info stream_info::from_string ( const std::string & data)
staticnodiscard

Deserialize a stream_info from a network transport string.

Definition at line 205 of file lsl_stream_info.cpp.

◆ hostname()

std::string stream_info::hostname ( ) const
nodiscardnoexcept

Hostname of the machine from which the stream originates.

Definition at line 150 of file lsl_stream_info.cpp.

◆ name()

std::string stream_info::name ( ) const
nodiscardnoexcept

Name of the stream.

Definition at line 101 of file lsl_stream_info.cpp.

◆ nominal_srate()

double stream_info::nominal_srate ( ) const
nodiscardnoexcept

Nominal sampling rate in Hz. 0.0 means irregular.

Definition at line 122 of file lsl_stream_info.cpp.

◆ operator=()

stream_info & LSLLIB::stream_info::operator= ( const stream_info & other)
default

Copy assignment operator.

◆ set_data_host()

void stream_info::set_data_host ( const std::string & host)

Set the data host (used internally during discovery).

Definition at line 178 of file lsl_stream_info.cpp.

◆ set_data_port()

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 lsl_stream_info.cpp.

◆ source_id()

std::string stream_info::source_id ( ) const
nodiscardnoexcept

Unique source identifier.

Definition at line 136 of file lsl_stream_info.cpp.

◆ to_string()

std::string stream_info::to_string ( ) const
nodiscard

Serialize stream_info into a string for network transport.

Definition at line 185 of file lsl_stream_info.cpp.

◆ type()

std::string stream_info::type ( ) const
nodiscardnoexcept

Content type of the stream.

Definition at line 108 of file lsl_stream_info.cpp.

◆ uid()

std::string stream_info::uid ( ) const
nodiscardnoexcept

A unique identifier for this particular stream instance (auto-generated).

Definition at line 143 of file lsl_stream_info.cpp.


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