v2.0.0
Loading...
Searching...
No Matches
lsl_stream_info.h
Go to the documentation of this file.
1//=============================================================================================================
32
33#ifndef LSL_STREAM_INFO_H
34#define LSL_STREAM_INFO_H
35
36//=============================================================================================================
37// INCLUDES
38//=============================================================================================================
39
40#include "lsl_global.h"
41
42//=============================================================================================================
43// STL INCLUDES
44//=============================================================================================================
45
46#include <string>
47#include <string_view>
48
49//=============================================================================================================
50// DEFINE NAMESPACE LSLLIB
51//=============================================================================================================
52
53namespace LSLLIB
54{
55
56//=============================================================================================================
60enum class ChannelFormat : int
61{
63 Float32 = 1,
65 String = 3,
66 Int32 = 4,
67 Int16 = 5,
68 Int8 = 6,
69 Int64 = 7
70};
71
72//=============================================================================================================
79{
80public:
81 //=========================================================================================================
86
87 //=========================================================================================================
98 stream_info(const std::string& name,
99 const std::string& type,
100 int channel_count = 0,
101 double nominal_srate = 0.0,
103 const std::string& source_id = "");
104
105 //=========================================================================================================
111 stream_info(const stream_info& other) = default;
112
113 //=========================================================================================================
121 stream_info& operator=(const stream_info& other) = default;
122
123 //=========================================================================================================
126
132 [[nodiscard]] std::string name() const noexcept;
133
139 [[nodiscard]] std::string type() const noexcept;
140
146 [[nodiscard]] int channel_count() const noexcept;
147
153 [[nodiscard]] double nominal_srate() const noexcept;
154
160 [[nodiscard]] ChannelFormat channel_format() const noexcept;
161
167 [[nodiscard]] std::string source_id() const noexcept;
168
170
171 //=========================================================================================================
174
180 [[nodiscard]] std::string uid() const noexcept;
181
187 [[nodiscard]] std::string hostname() const noexcept;
188
190
191 //=========================================================================================================
194
200 [[nodiscard]] int data_port() const noexcept;
201
207 [[nodiscard]] std::string data_host() const noexcept;
208
214 void set_data_port(int port);
215
221 void set_data_host(const std::string& host);
222
224
225 //=========================================================================================================
228
234 [[nodiscard]] std::string to_string() const;
235
243 [[nodiscard]] static stream_info from_string(const std::string& data);
244
246
247private:
248 std::string m_name;
249 std::string m_type;
250 int m_channel_count;
251 double m_nominal_srate;
252 ChannelFormat m_channel_format;
253 std::string m_source_id;
254 std::string m_uid;
255 std::string m_hostname;
256
257 int m_data_port;
258 std::string m_data_host;
259};
260
261} // namespace LSLLIB
262
263#endif // LSL_STREAM_INFO_H
LSLLIB shared-library export macro and build-stamp accessors used by every public LSL symbol.
#define LSLSHARED_EXPORT
Definition lsl_global.h:51
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).