Skip to content

Commit

Permalink
cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Oct 25, 2024
1 parent 98719a7 commit fa12aae
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<rerun::Position3D> points = grid3d<rerun::Position3D, float>(-10.f, 10.f, 10);
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/concepts/app-model/native-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ int main() {
// Connect to the Rerun TCP server using the default address and
// port: localhost:9876
const auto rec = rerun::RecordingStream("rerun_example_native_sync");
rec.connect().exit_on_failure();
rec.connect_tcp().exit_on_failure();

// Log data as usual, thereby pushing it into the TCP socket.
while (true) {
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/all/quick_start/quick_start_connect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<rerun::Position3D> points = grid3d<rerun::Position3D, float>(-10.f, 10.f, 10);
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/log_file/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int main(int argc, char** argv) {
if (args["spawn"].as<bool>()) {
rec.spawn().exit_on_failure();
} else if (args["connect"].as<bool>()) {
rec.connect().exit_on_failure();
rec.connect_tcp().exit_on_failure();
} else if (args["stdout"].as<bool>()) {
rec.to_stdout().exit_on_failure();
} else if (args.count("save")) {
Expand Down
4 changes: 4 additions & 0 deletions rerun_cpp/src/rerun/recording_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 17 additions & 2 deletions rerun_cpp/src/rerun/recording_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp/plot_dashboard_stress/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ int main(int argc, char** argv) {
if (args["spawn"].as<bool>()) {
rec.spawn().exit_on_failure();
} else if (args["connect"].as<bool>()) {
rec.connect().exit_on_failure();
rec.connect_tcp().exit_on_failure();
} else if (args["stdout"].as<bool>()) {
rec.to_stdout().exit_on_failure();
} else if (args.count("save")) {
Expand Down

0 comments on commit fa12aae

Please sign in to comment.