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//=============================================================================================================
59enum class ChannelFormat : int {
61 Float32 = 1,
63 String = 3,
64 Int32 = 4,
65 Int16 = 5,
66 Int8 = 6,
67 Int64 = 7
68};
69
70//=============================================================================================================
75{
76public:
77 //=========================================================================================================
82
83 //=========================================================================================================
94 stream_info(const std::string& name,
95 const std::string& type,
96 int channel_count = 0,
97 double nominal_srate = 0.0,
99 const std::string& source_id = "");
100
101 //=========================================================================================================
105 stream_info(const stream_info& other) = default;
106
107 //=========================================================================================================
111 stream_info& operator=(const stream_info& other) = default;
112
113 //=========================================================================================================
116
118 [[nodiscard]] std::string name() const noexcept;
119
121 [[nodiscard]] std::string type() const noexcept;
122
124 [[nodiscard]] int channel_count() const noexcept;
125
127 [[nodiscard]] double nominal_srate() const noexcept;
128
130 [[nodiscard]] ChannelFormat channel_format() const noexcept;
131
133 [[nodiscard]] std::string source_id() const noexcept;
134
136
137 //=========================================================================================================
140
142 [[nodiscard]] std::string uid() const noexcept;
143
145 [[nodiscard]] std::string hostname() const noexcept;
146
148
149 //=========================================================================================================
152
154 [[nodiscard]] int data_port() const noexcept;
155
157 [[nodiscard]] std::string data_host() const noexcept;
158
160 void set_data_port(int port);
161
163 void set_data_host(const std::string& host);
164
166
167 //=========================================================================================================
170
172 [[nodiscard]] std::string to_string() const;
173
175 [[nodiscard]] static stream_info from_string(const std::string& data);
176
178
179private:
180 std::string m_name;
181 std::string m_type;
182 int m_channel_count;
183 double m_nominal_srate;
184 ChannelFormat m_channel_format;
185 std::string m_source_id;
186 std::string m_uid;
187 std::string m_hostname;
188
189 int m_data_port;
190 std::string m_data_host;
191};
192
193} // namespace LSLLIB
194
195#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).