v2.0.0
Loading...
Searching...
No Matches
lsl_stream_info.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef LSL_STREAM_INFO_H
36#define LSL_STREAM_INFO_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "lsl_global.h"
43
44//=============================================================================================================
45// STL INCLUDES
46//=============================================================================================================
47
48#include <string>
49#include <string_view>
50
51//=============================================================================================================
52// DEFINE NAMESPACE LSLLIB
53//=============================================================================================================
54
55namespace LSLLIB {
56
57//=============================================================================================================
61enum class ChannelFormat : int {
63 Float32 = 1,
65 String = 3,
66 Int32 = 4,
67 Int16 = 5,
68 Int8 = 6,
69 Int64 = 7
70};
71
72//=============================================================================================================
83{
84public:
85 //=========================================================================================================
90
91 //=========================================================================================================
102 stream_info(const std::string& name,
103 const std::string& type,
104 int channel_count = 0,
105 double nominal_srate = 0.0,
107 const std::string& source_id = "");
108
109 //=========================================================================================================
113 stream_info(const stream_info& other) = default;
114
115 //=========================================================================================================
119 stream_info& operator=(const stream_info& other) = default;
120
121 //=========================================================================================================
124
126 [[nodiscard]] std::string name() const noexcept;
127
129 [[nodiscard]] std::string type() const noexcept;
130
132 [[nodiscard]] int channel_count() const noexcept;
133
135 [[nodiscard]] double nominal_srate() const noexcept;
136
138 [[nodiscard]] ChannelFormat channel_format() const noexcept;
139
141 [[nodiscard]] std::string source_id() const noexcept;
142
144
145 //=========================================================================================================
148
150 [[nodiscard]] std::string uid() const noexcept;
151
153 [[nodiscard]] std::string hostname() const noexcept;
154
156
157 //=========================================================================================================
160
162 [[nodiscard]] int data_port() const noexcept;
163
165 [[nodiscard]] std::string data_host() const noexcept;
166
168 void set_data_port(int port);
169
171 void set_data_host(const std::string& host);
172
174
175 //=========================================================================================================
178
180 [[nodiscard]] std::string to_string() const;
181
183 [[nodiscard]] static stream_info from_string(const std::string& data);
184
186
187private:
188 std::string m_name;
189 std::string m_type;
190 int m_channel_count;
191 double m_nominal_srate;
192 ChannelFormat m_channel_format;
193 std::string m_source_id;
194 std::string m_uid;
195 std::string m_hostname;
196
197 int m_data_port;
198 std::string m_data_host;
199};
200
201} // namespace LSLLIB
202
203#endif // LSL_STREAM_INFO_H
lsl library export/import macros.
#define LSLSHARED_EXPORT
Definition lsl_global.h:55
Lab Streaming Layer (LSL) integration for real-time data exchange.
stream_info & operator=(const stream_info &other)=default
int channel_count() const noexcept
Number of channels.
int data_port() const noexcept
TCP data port of the outlet.
double nominal_srate() const noexcept
Nominal sampling rate in Hz. 0.0 means irregular.
std::string to_string() const
Serialize stream_info into a string for network transport.
std::string hostname() const noexcept
Hostname of the machine from which the stream originates.
stream_info(const stream_info &other)=default
void set_data_host(const std::string &host)
Set the data host (used internally during discovery).
std::string source_id() const noexcept
Unique source identifier.
void set_data_port(int port)
Set the TCP data port (used internally during discovery / outlet creation).
ChannelFormat channel_format() const noexcept
Data format of a channel.
std::string uid() const noexcept
A unique identifier for this particular stream instance (auto-generated).
std::string name() const noexcept
Name of the stream.
std::string type() const noexcept
Content type of the stream.
static stream_info from_string(const std::string &data)
Deserialize a stream_info from a network transport string.
std::string data_host() const noexcept
Host address of the outlet (IP, set from UDP sender address during discovery).