From 197e009f397dab8d1096981758abdbcd9ee5265d Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 31 Jan 2025 16:52:25 +0100 Subject: [PATCH] Deprecate C++ TimeColumn::from_sequence_points in favor of `TimeColumn::from_sequence` --- .../all/archetypes/image_send_columns.cpp | 2 +- .../all/archetypes/scalar_send_columns.cpp | 2 +- rerun_cpp/src/rerun/archetypes/scalar.hpp | 2 +- rerun_cpp/src/rerun/time_column.hpp | 21 +++++++++++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/snippets/all/archetypes/image_send_columns.cpp b/docs/snippets/all/archetypes/image_send_columns.cpp index d7c6d40fde1b..7653ad70ccbf 100644 --- a/docs/snippets/all/archetypes/image_send_columns.cpp +++ b/docs/snippets/all/archetypes/image_send_columns.cpp @@ -44,7 +44,7 @@ int main() { // Send all images at once. rec.send_columns( "images", - rerun::TimeColumn::from_sequence_points("step", std::move(times)), + rerun::TimeColumn::from_sequence("step", std::move(times)), rerun::Image().with_many_buffer(std::move(image_data)).columns() ); } diff --git a/docs/snippets/all/archetypes/scalar_send_columns.cpp b/docs/snippets/all/archetypes/scalar_send_columns.cpp index 1a748591f037..a4765e21aa09 100644 --- a/docs/snippets/all/archetypes/scalar_send_columns.cpp +++ b/docs/snippets/all/archetypes/scalar_send_columns.cpp @@ -21,7 +21,7 @@ int main() { // Serialize to columns and send. rec.send_columns( "scalars", - rerun::TimeColumn::from_sequence_points("step", std::move(times)), + rerun::TimeColumn::from_sequence("step", std::move(times)), rerun::Scalar().with_many_scalar(std::move(scalar_data)).columns() ); } diff --git a/rerun_cpp/src/rerun/archetypes/scalar.hpp b/rerun_cpp/src/rerun/archetypes/scalar.hpp index eed555eb6eda..747f3613b2d4 100644 --- a/rerun_cpp/src/rerun/archetypes/scalar.hpp +++ b/rerun_cpp/src/rerun/archetypes/scalar.hpp @@ -73,7 +73,7 @@ namespace rerun::archetypes { /// // Serialize to columns and send. /// rec.send_columns( /// "scalars", - /// rerun::TimeColumn::from_sequence_points("step", std::move(times)), + /// rerun::TimeColumn::from_sequence("step", std::move(times)), /// rerun::Scalar().with_many_scalar(std::move(scalar_data)).columns() /// ); /// } diff --git a/rerun_cpp/src/rerun/time_column.hpp b/rerun_cpp/src/rerun/time_column.hpp index 111b66cbb522..d16dfe7af616 100644 --- a/rerun_cpp/src/rerun/time_column.hpp +++ b/rerun_cpp/src/rerun/time_column.hpp @@ -69,6 +69,9 @@ namespace rerun { /// Make sure the sorting status is correctly specified. /// \param sorting_status The sorting status of the sequence points. /// Already sorted time points may perform better. + /// + /// \deprecated Use `from_sequence` instead. + [[deprecated("Use `from_sequence` instead.")]] static TimeColumn from_sequence_points( std::string timeline_name, Collection sequence_points, SortingStatus sorting_status = SortingStatus::Unknown @@ -80,6 +83,24 @@ namespace rerun { ); } + /// Creates a time column from an array of sequence points. + /// + /// \param timeline_name The name of the timeline this column belongs to. + /// \param sequence_points The sequence points. + /// Make sure the sorting status is correctly specified. + /// \param sorting_status The sorting status of the sequence points. + /// Already sorted time points may perform better. + static TimeColumn from_sequence( + std::string timeline_name, Collection sequence_points, + SortingStatus sorting_status = SortingStatus::Unknown + ) { + return TimeColumn( + Timeline(std::move(timeline_name), TimeType::Sequence), + std::move(sequence_points), + sorting_status + ); + } + /// Creates a time column from an array of nanoseconds. /// /// \param timeline_name The name of the timeline this column belongs to.