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

Value-type descriptor of a single LSL stream: semantic metadata plus transport endpoint, API-compatible with liblsl's stream_info. 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_info & operator= (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

Value-type descriptor of a single LSL stream: semantic metadata plus transport endpoint, API-compatible with liblsl's stream_info.

Definition at line 78 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 60 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 76 of file lsl_stream_info.cpp.

◆ stream_info() [3/3]

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

Copy constructor.

Parameters
[in]otherstream_info to copy.

Member Function Documentation

◆ channel_count()

int stream_info::channel_count ( ) const
nodiscardnoexcept

Number of channels.

Returns
The number of channels per sample.

Definition at line 111 of file lsl_stream_info.cpp.

◆ channel_format()

ChannelFormat stream_info::channel_format ( ) const
nodiscardnoexcept

Data format of a channel.

Returns
The per-channel sample format.

Definition at line 125 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).

Returns
The outlet host address, or an empty string if not yet discovered.

Definition at line 160 of file lsl_stream_info.cpp.

◆ data_port()

int stream_info::data_port ( ) const
nodiscardnoexcept

TCP data port of the outlet.

Returns
The TCP port number, or 0 if not yet assigned.

Definition at line 153 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.

Parameters
[in]dataPipe-delimited string as produced by to_string().
Returns
The parsed stream_info, or a default-constructed (empty) one if the header or field count is invalid.

Definition at line 201 of file lsl_stream_info.cpp.

◆ hostname()

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

Hostname of the machine from which the stream originates.

Returns
The local host name captured at construction time.

Definition at line 146 of file lsl_stream_info.cpp.

◆ name()

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

Name of the stream.

Returns
The stream name, e.g. "EEG"; empty for a default-constructed object.

Definition at line 97 of file lsl_stream_info.cpp.

◆ nominal_srate()

double stream_info::nominal_srate ( ) const
nodiscardnoexcept

Nominal sampling rate in Hz. 0.0 means irregular.

Returns
The nominal sampling rate in Hz, or 0.0 for irregular streams.

Definition at line 118 of file lsl_stream_info.cpp.

◆ operator=()

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

Copy assignment operator.

Parameters
[in]otherstream_info to copy.
Returns
Reference to this object.

◆ set_data_host()

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

Set the data host (used internally during discovery).

Parameters
[in]hostIP address or host name of the outlet.

Definition at line 174 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).

Parameters
[in]portTCP port number on which the outlet serves data.

Definition at line 167 of file lsl_stream_info.cpp.

◆ source_id()

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

Unique source identifier.

Returns
The device or source identifier; may be empty if none was given.

Definition at line 132 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.

Returns
Pipe-delimited string starting with the MNELSL1 header followed by all fields except data_host.

Definition at line 181 of file lsl_stream_info.cpp.

◆ type()

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

Content type of the stream.

Returns
The content type, e.g. "EEG" or "Markers".

Definition at line 104 of file lsl_stream_info.cpp.

◆ uid()

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

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

Returns
The instance UUID as a string without braces; empty for a default-constructed object.

Definition at line 139 of file lsl_stream_info.cpp.


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