Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Mar 4, 2024
1 parent be76a0d commit 7ae4317
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions crates/rerun_c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,6 @@ fn rr_log_file_from_path_impl(
let entity_path_prefix = entity_path_prefix.as_str("entity_path_prefix").ok();

stream
// TODO(cmc): expose settings
.log_file_from_path(filepath, entity_path_prefix.map(Into::into), timeless)
.map_err(|err| {
CError::new(
Expand Down Expand Up @@ -782,7 +781,6 @@ fn rr_log_file_from_contents_impl(
let entity_path_prefix = entity_path_prefix.as_str("entity_path_prefix").ok();

stream
// TODO(cmc): expose settings
.log_file_from_contents(
filepath,
std::borrow::Cow::Borrowed(contents),
Expand Down
16 changes: 12 additions & 4 deletions examples/cpp/external_data_loader/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void set_time_from_args(const rerun::RecordingStream& rec, cxxopts::ParseResult&
auto pos = time_str.find('=');
if (pos != std::string::npos) {
auto timeline_name = time_str.substr(0, pos);
int64_t time = std::stoi(time_str.substr(pos + 1));
int64_t time = std::stol(time_str.substr(pos + 1));
rec.set_time_seconds(timeline_name, time);
}
}
Expand All @@ -28,7 +28,7 @@ void set_time_from_args(const rerun::RecordingStream& rec, cxxopts::ParseResult&
auto pos = sequence_str.find('=');
if (pos != std::string::npos) {
auto timeline_name = sequence_str.substr(0, pos);
int64_t sequence = std::stoi(sequence_str.substr(pos + 1));
int64_t sequence = std::stol(sequence_str.substr(pos + 1));
rec.set_time_sequence(timeline_name, sequence);
}
}
Expand Down Expand Up @@ -100,18 +100,26 @@ file with Rerun (`rerun file.cpp`).

std::string text = "## Some C++ code\n```cpp\n" + body.str() + "\n```\n";

auto application_id = std::string_view("rerun_example_external_data_loader");
if (args.count("application-id")) {
application_id = args["application-id"].as<std::string>();
}
auto recording_id = std::string_view();
if (args.count("recording-id")) {
recording_id = args["recording-id"].as<std::string>();
}
const auto rec = rerun::RecordingStream("rerun_example_external_data_loader", recording_id);
const auto rec = rerun::RecordingStream(application_id, recording_id);
// The most important part of this: log to standard output so the Rerun Viewer can ingest it!
rec.to_stdout().exit_on_failure();

set_time_from_args(rec, args);

auto entity_path = std::string(filepath);
if (args.count("entity-path-prefix")) {
entity_path = args["entity-path-prefix"].as<std::string>() + "/" + filepath;
}
rec.log_with_timeless(
filepath,
entity_path,
args["timeless"].as<bool>(),
rerun::TextDocument(text).with_media_type(rerun::MediaType::markdown())
);
Expand Down

0 comments on commit 7ae4317

Please sign in to comment.