From 002345df01acc63ce4438915aeaaedfe81cdc683 Mon Sep 17 00:00:00 2001 From: Clement Rey Date: Fri, 25 Oct 2024 13:03:00 +0200 Subject: [PATCH] cpp --- .../quick_start_connect.cpp | 2 +- .../all/quick_start/quick_start_connect.cpp | 2 +- rerun_cpp/src/rerun/recording_stream.cpp | 4 ++++ rerun_cpp/src/rerun/recording_stream.hpp | 19 +++++++++++++++++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/viewer/re_viewer/data/quick_start_guides/quick_start_connect.cpp b/crates/viewer/re_viewer/data/quick_start_guides/quick_start_connect.cpp index b2144eed9831f..1bdd80ab984ee 100644 --- a/crates/viewer/re_viewer/data/quick_start_guides/quick_start_connect.cpp +++ b/crates/viewer/re_viewer/data/quick_start_guides/quick_start_connect.cpp @@ -6,7 +6,7 @@ using namespace rerun::demo; int main() { // Create a new `RecordingStream` which sends data over TCP to the viewer process. const auto rec = rerun::RecordingStream("rerun_example_quick_start_connect"); - rec.connect().exit_on_failure(); + rec.connect_tcp().exit_on_failure(); // Create some data using the `grid` utility function. std::vector points = grid3d(-10.f, 10.f, 10); diff --git a/docs/snippets/all/quick_start/quick_start_connect.cpp b/docs/snippets/all/quick_start/quick_start_connect.cpp index b2144eed9831f..1bdd80ab984ee 100644 --- a/docs/snippets/all/quick_start/quick_start_connect.cpp +++ b/docs/snippets/all/quick_start/quick_start_connect.cpp @@ -6,7 +6,7 @@ using namespace rerun::demo; int main() { // Create a new `RecordingStream` which sends data over TCP to the viewer process. const auto rec = rerun::RecordingStream("rerun_example_quick_start_connect"); - rec.connect().exit_on_failure(); + rec.connect_tcp().exit_on_failure(); // Create some data using the `grid` utility function. std::vector points = grid3d(-10.f, 10.f, 10); diff --git a/rerun_cpp/src/rerun/recording_stream.cpp b/rerun_cpp/src/rerun/recording_stream.cpp index 88de76f098729..6e4beb2735727 100644 --- a/rerun_cpp/src/rerun/recording_stream.cpp +++ b/rerun_cpp/src/rerun/recording_stream.cpp @@ -101,6 +101,10 @@ namespace rerun { } Error RecordingStream::connect(std::string_view tcp_addr, float flush_timeout_sec) const { + return RecordingStream::connect_tcp(tcp_addr, flush_timeout_sec); + } + + Error RecordingStream::connect_tcp(std::string_view tcp_addr, float flush_timeout_sec) const { rr_error status = {}; rr_recording_stream_connect( _id, diff --git a/rerun_cpp/src/rerun/recording_stream.hpp b/rerun_cpp/src/rerun/recording_stream.hpp index 854b561d7487b..f07549fde1e7c 100644 --- a/rerun_cpp/src/rerun/recording_stream.hpp +++ b/rerun_cpp/src/rerun/recording_stream.hpp @@ -143,8 +143,23 @@ namespace rerun { /// timeout, and can cause a call to `flush` to block indefinitely. /// /// This function returns immediately. - Error connect(std::string_view tcp_addr = "127.0.0.1:9876", float flush_timeout_sec = 2.0) - const; + [[deprecated("Use `connect_tcp` instead")]] Error connect( + std::string_view tcp_addr = "127.0.0.1:9876", float flush_timeout_sec = 2.0 + ) const; + + /// Connect to a remote Rerun Viewer on the given ip:port. + /// + /// Requires that you first start a Rerun Viewer by typing 'rerun' in a terminal. + /// + /// flush_timeout_sec: + /// The minimum time the SDK will wait during a flush before potentially + /// dropping data if progress is not being made. Passing a negative value indicates no + /// timeout, and can cause a call to `flush` to block indefinitely. + /// + /// This function returns immediately. + Error connect_tcp( + std::string_view tcp_addr = "127.0.0.1:9876", float flush_timeout_sec = 2.0 + ) const; /// Spawns a new Rerun Viewer process from an executable available in PATH, then connects to it /// over TCP.