Skip to content

Commit d53841a

Browse files
committed
Add C++ API function to retrieve the opaque C API stream inlet/outlet handles
1 parent 1be5cf0 commit d53841a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/lsl_cpp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,11 @@ class stream_outlet {
766766
*/
767767
stream_info info() const { return stream_info(lsl_get_info(obj.get())); }
768768

769+
/// Return a shared pointer to pass to C-API functions that aren't wrapped yet
770+
///
771+
/// Example: @code lsl_push_chunk_buft(outlet.handle().get(), data, …); @endcode
772+
std::shared_ptr<lsl_outlet_struct_> handle() { return obj; }
773+
769774
/** Destructor.
770775
* The stream will no longer be discoverable after destruction and all paired inlets will stop
771776
* delivering data.
@@ -899,6 +904,11 @@ class stream_inlet {
899904
: channel_count(info.channel_count()),
900905
obj(lsl_create_inlet(info.handle().get(), max_buflen, max_chunklen, recover), &lsl_destroy_inlet) {}
901906

907+
/// Return a shared pointer to pass to C-API functions that aren't wrapped yet
908+
///
909+
/// Example: @code lsl_pull_sample_buf(inlet.handle().get(), buf, …); @endcode
910+
std::shared_ptr<lsl_inlet_struct_> handle() { return obj; }
911+
902912
/// Move constructor for stream_inlet
903913
stream_inlet(stream_inlet &&rhs) noexcept = default;
904914
stream_inlet &operator=(stream_inlet &&rhs) noexcept= default;

0 commit comments

Comments
 (0)