diff --git a/.typos.toml b/.typos.toml index 1145a6da202d..5ff10e5b16a6 100644 --- a/.typos.toml +++ b/.typos.toml @@ -29,7 +29,8 @@ authorise = "authorize" behaviour = "behavior" British = "American" calibre = "caliber" -cancelled = "canceled" +# allow 'cancelled' since Arrow uses it. +#cancelled = "canceled" candour = "candor" capitalise = "capitalize" catalogue = "catalog" diff --git a/crates/re_types/source_hash.txt b/crates/re_types/source_hash.txt index 4c02f2632572..56d112c4729d 100644 --- a/crates/re_types/source_hash.txt +++ b/crates/re_types/source_hash.txt @@ -1,4 +1,4 @@ # This is a sha256 hash for all direct and indirect dependencies of this crate's build script. # It can be safely removed at anytime to force the build script to run again. # Check out build.rs to see how it's computed. -cc08a1608948ac01f58350d37a5fbf60ebbbdffeadee919a84237aa155b3642b +dcbcb70a5509902f5c6cdf7405e3af253de84885ff2b91a68115dfa0aa364310 diff --git a/crates/re_types_builder/src/codegen/cpp/mod.rs b/crates/re_types_builder/src/codegen/cpp/mod.rs index 89b4b1236b08..c831555e325b 100644 --- a/crates/re_types_builder/src/codegen/cpp/mod.rs +++ b/crates/re_types_builder/src/codegen/cpp/mod.rs @@ -1122,6 +1122,7 @@ fn component_to_data_cell_method( cpp_includes: &mut Includes, ) -> Method { hpp_includes.local.insert("../data_cell.hpp".to_owned()); + hpp_includes.local.insert("../result.hpp".to_owned()); cpp_includes.local.insert("../arrow.hpp".to_owned()); // ipc_from_table cpp_includes.system.insert("arrow/api.h".to_owned()); @@ -1131,7 +1132,7 @@ fn component_to_data_cell_method( docs: format!("Creates a Rerun DataCell from an array of {type_ident} components.").into(), declaration: MethodDeclaration { is_static: true, - return_type: quote! { arrow::Result }, + return_type: quote! { Result }, name_and_parameters: quote! { to_data_cell(const #type_ident* instances, size_t num_instances) }, @@ -1163,7 +1164,11 @@ fn component_to_data_cell_method( #NEWLINE_TOKEN rerun::DataCell cell; cell.component_name = #type_ident::NAME; - ARROW_ASSIGN_OR_RAISE(cell.buffer, rerun::ipc_from_table(*arrow::Table::Make(schema, {array}))); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); #NEWLINE_TOKEN #NEWLINE_TOKEN return cell; @@ -1178,6 +1183,7 @@ fn archetype_to_data_cells( cpp_includes: &mut Includes, ) -> Method { hpp_includes.local.insert("../data_cell.hpp".to_owned()); + hpp_includes.local.insert("../result.hpp".to_owned()); cpp_includes.system.insert("arrow/api.h".to_owned()); // TODO(andreas): Splats need to be handled separately. @@ -1203,8 +1209,11 @@ fn archetype_to_data_cells( quote! { if (#field_name.has_value()) { const auto& value = #field_name.value(); - ARROW_ASSIGN_OR_RAISE(const auto cell, #to_data_cell); - cells.push_back(cell); + const auto result = #to_data_cell; + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } } } else { @@ -1215,8 +1224,11 @@ fn archetype_to_data_cells( }; quote! { { - ARROW_ASSIGN_OR_RAISE(const auto cell, #to_data_cell); - cells.push_back(cell); + const auto result = #to_data_cell; + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } } } @@ -1226,7 +1238,7 @@ fn archetype_to_data_cells( docs: "Creates a list of Rerun DataCell from this archetype.".into(), declaration: MethodDeclaration { is_static: false, - return_type: quote!(arrow::Result>), + return_type: quote!(Result>), name_and_parameters: quote!(to_data_cells() const), }, definition_body: quote! { diff --git a/crates/rerun_c/src/lib.rs b/crates/rerun_c/src/lib.rs index e52d2b0de6ac..e66ed902ae4b 100644 --- a/crates/rerun_c/src/lib.rs +++ b/crates/rerun_c/src/lib.rs @@ -78,22 +78,22 @@ pub struct CDataRow { pub enum CErrorCode { Ok = 0, - _CategoryArgument = 0x000000010, + _CategoryArgument = 0x0000_00010, UnexpectedNullArgument, InvalidStringArgument, InvalidRecordingStreamHandle, InvalidSocketAddress, InvalidEntityPath, - _CategoryRecordingStream = 0x000000100, + _CategoryRecordingStream = 0x0000_00100, RecordingStreamCreationFailure, RecordingStreamSaveFailure, - _CategoryArrow = 0x000001000, + _CategoryArrow = 0x0000_1000, ArrowIpcMessageParsingFailure, ArrowDataCellError, - Unknown = 0xFFFFFFFF, + Unknown = 0xFFFF_FFFF, } #[repr(C)] diff --git a/crates/rerun_c/src/rerun.h b/crates/rerun_c/src/rerun.h index a7f9f8932e00..5ef8316eeb15 100644 --- a/crates/rerun_c/src/rerun.h +++ b/crates/rerun_c/src/rerun.h @@ -106,7 +106,7 @@ enum { RR_ERROR_CODE_OK = 0, // Invalid argument errors. - _RR_ERROR_CODE_CATEGORY_ARGUMENT = 0x000000010, + _RR_ERROR_CODE_CATEGORY_ARGUMENT = 0x00000010, RR_ERROR_CODE_UNEXPECTED_NULL_ARGUMENT, RR_ERROR_CODE_INVALID_STRING_ARGUMENT, RR_ERROR_CODE_INVALID_RECORDING_STREAM_HANDLE, diff --git a/rerun_cpp/src/rerun.hpp b/rerun_cpp/src/rerun.hpp index 290c763a252a..0efaf5b1c854 100644 --- a/rerun_cpp/src/rerun.hpp +++ b/rerun_cpp/src/rerun.hpp @@ -9,4 +9,5 @@ // Rerun API. #include "rerun/error.hpp" #include "rerun/recording_stream.hpp" +#include "rerun/result.hpp" #include "rerun/sdk_info.hpp" diff --git a/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.cpp b/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.cpp index c97bc473a7ba..f3dcd237280b 100644 --- a/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.cpp +++ b/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.cpp @@ -28,563 +28,617 @@ namespace rerun { namespace archetypes { - arrow::Result> AffixFuzzer1::to_data_cells() const { + Result> AffixFuzzer1::to_data_cells() const { std::vector cells; cells.reserve(74); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer1::to_data_cell(&fuzz1001, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer1::to_data_cell(&fuzz1001, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer2::to_data_cell(&fuzz1002, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer2::to_data_cell(&fuzz1002, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer3::to_data_cell(&fuzz1003, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer3::to_data_cell(&fuzz1003, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer4::to_data_cell(&fuzz1004, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer4::to_data_cell(&fuzz1004, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer5::to_data_cell(&fuzz1005, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer5::to_data_cell(&fuzz1005, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer6::to_data_cell(&fuzz1006, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer6::to_data_cell(&fuzz1006, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer7::to_data_cell(&fuzz1007, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer7::to_data_cell(&fuzz1007, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer8::to_data_cell(&fuzz1008, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer8::to_data_cell(&fuzz1008, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer9::to_data_cell(&fuzz1009, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer9::to_data_cell(&fuzz1009, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer10::to_data_cell(&fuzz1010, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer10::to_data_cell(&fuzz1010, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer11::to_data_cell(&fuzz1011, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer11::to_data_cell(&fuzz1011, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer12::to_data_cell(&fuzz1012, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer12::to_data_cell(&fuzz1012, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer13::to_data_cell(&fuzz1013, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer13::to_data_cell(&fuzz1013, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer14::to_data_cell(&fuzz1014, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer14::to_data_cell(&fuzz1014, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer15::to_data_cell(&fuzz1015, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer15::to_data_cell(&fuzz1015, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer16::to_data_cell(&fuzz1016, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer16::to_data_cell(&fuzz1016, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer17::to_data_cell(&fuzz1017, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer17::to_data_cell(&fuzz1017, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer18::to_data_cell(&fuzz1018, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer18::to_data_cell(&fuzz1018, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer19::to_data_cell(&fuzz1019, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer19::to_data_cell(&fuzz1019, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer20::to_data_cell(&fuzz1020, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer20::to_data_cell(&fuzz1020, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer1::to_data_cell(fuzz1101.data(), fuzz1101.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer1::to_data_cell(fuzz1101.data(), fuzz1101.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer2::to_data_cell(fuzz1102.data(), fuzz1102.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer2::to_data_cell(fuzz1102.data(), fuzz1102.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer3::to_data_cell(fuzz1103.data(), fuzz1103.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer3::to_data_cell(fuzz1103.data(), fuzz1103.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer4::to_data_cell(fuzz1104.data(), fuzz1104.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer4::to_data_cell(fuzz1104.data(), fuzz1104.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer5::to_data_cell(fuzz1105.data(), fuzz1105.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer5::to_data_cell(fuzz1105.data(), fuzz1105.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer6::to_data_cell(fuzz1106.data(), fuzz1106.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer6::to_data_cell(fuzz1106.data(), fuzz1106.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer7::to_data_cell(fuzz1107.data(), fuzz1107.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer7::to_data_cell(fuzz1107.data(), fuzz1107.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer8::to_data_cell(fuzz1108.data(), fuzz1108.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer8::to_data_cell(fuzz1108.data(), fuzz1108.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer9::to_data_cell(fuzz1109.data(), fuzz1109.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer9::to_data_cell(fuzz1109.data(), fuzz1109.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer10::to_data_cell(fuzz1110.data(), fuzz1110.size()) + const auto result = rerun::components::AffixFuzzer10::to_data_cell( + fuzz1110.data(), + fuzz1110.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer11::to_data_cell(fuzz1111.data(), fuzz1111.size()) + const auto result = rerun::components::AffixFuzzer11::to_data_cell( + fuzz1111.data(), + fuzz1111.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer12::to_data_cell(fuzz1112.data(), fuzz1112.size()) + const auto result = rerun::components::AffixFuzzer12::to_data_cell( + fuzz1112.data(), + fuzz1112.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer13::to_data_cell(fuzz1113.data(), fuzz1113.size()) + const auto result = rerun::components::AffixFuzzer13::to_data_cell( + fuzz1113.data(), + fuzz1113.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer14::to_data_cell(fuzz1114.data(), fuzz1114.size()) + const auto result = rerun::components::AffixFuzzer14::to_data_cell( + fuzz1114.data(), + fuzz1114.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer15::to_data_cell(fuzz1115.data(), fuzz1115.size()) + const auto result = rerun::components::AffixFuzzer15::to_data_cell( + fuzz1115.data(), + fuzz1115.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer16::to_data_cell(fuzz1116.data(), fuzz1116.size()) + const auto result = rerun::components::AffixFuzzer16::to_data_cell( + fuzz1116.data(), + fuzz1116.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer17::to_data_cell(fuzz1117.data(), fuzz1117.size()) + const auto result = rerun::components::AffixFuzzer17::to_data_cell( + fuzz1117.data(), + fuzz1117.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer18::to_data_cell(fuzz1118.data(), fuzz1118.size()) + const auto result = rerun::components::AffixFuzzer18::to_data_cell( + fuzz1118.data(), + fuzz1118.size() ); - cells.push_back(cell); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2001.has_value()) { const auto& value = fuzz2001.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer1::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer1::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2002.has_value()) { const auto& value = fuzz2002.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer2::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer2::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2003.has_value()) { const auto& value = fuzz2003.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer3::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer3::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2004.has_value()) { const auto& value = fuzz2004.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer4::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer4::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2005.has_value()) { const auto& value = fuzz2005.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer5::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer5::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2006.has_value()) { const auto& value = fuzz2006.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer6::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer6::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2007.has_value()) { const auto& value = fuzz2007.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer7::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer7::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2008.has_value()) { const auto& value = fuzz2008.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer8::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer8::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2009.has_value()) { const auto& value = fuzz2009.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer9::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer9::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2010.has_value()) { const auto& value = fuzz2010.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer10::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer10::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2011.has_value()) { const auto& value = fuzz2011.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer11::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer11::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2012.has_value()) { const auto& value = fuzz2012.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer12::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer12::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2013.has_value()) { const auto& value = fuzz2013.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer13::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer13::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2014.has_value()) { const auto& value = fuzz2014.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer14::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer14::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2015.has_value()) { const auto& value = fuzz2015.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer15::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer15::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2016.has_value()) { const auto& value = fuzz2016.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer16::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer16::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2017.has_value()) { const auto& value = fuzz2017.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer17::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer17::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2018.has_value()) { const auto& value = fuzz2018.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer18::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AffixFuzzer18::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2101.has_value()) { const auto& value = fuzz2101.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer1::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer1::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2102.has_value()) { const auto& value = fuzz2102.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer2::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer2::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2103.has_value()) { const auto& value = fuzz2103.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer3::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer3::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2104.has_value()) { const auto& value = fuzz2104.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer4::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer4::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2105.has_value()) { const auto& value = fuzz2105.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer5::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer5::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2106.has_value()) { const auto& value = fuzz2106.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer6::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer6::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2107.has_value()) { const auto& value = fuzz2107.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer7::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer7::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2108.has_value()) { const auto& value = fuzz2108.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer8::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer8::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2109.has_value()) { const auto& value = fuzz2109.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer9::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer9::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2110.has_value()) { const auto& value = fuzz2110.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer10::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer10::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2111.has_value()) { const auto& value = fuzz2111.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer11::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer11::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2112.has_value()) { const auto& value = fuzz2112.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer12::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer12::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2113.has_value()) { const auto& value = fuzz2113.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer13::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer13::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2114.has_value()) { const auto& value = fuzz2114.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer14::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer14::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2115.has_value()) { const auto& value = fuzz2115.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer15::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer15::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2116.has_value()) { const auto& value = fuzz2116.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer16::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer16::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2117.has_value()) { const auto& value = fuzz2117.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer17::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer17::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (fuzz2118.has_value()) { const auto& value = fuzz2118.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AffixFuzzer18::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::AffixFuzzer18::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.hpp b/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.hpp index 49ff3f1ad158..fa935d6ec9b5 100644 --- a/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.hpp +++ b/rerun_cpp/src/rerun/archetypes/affix_fuzzer1.hpp @@ -24,6 +24,7 @@ #include "../components/affix_fuzzer8.hpp" #include "../components/affix_fuzzer9.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -619,7 +620,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/annotation_context.cpp b/rerun_cpp/src/rerun/archetypes/annotation_context.cpp index 3142a20618de..bf7f2dfc5f87 100644 --- a/rerun_cpp/src/rerun/archetypes/annotation_context.cpp +++ b/rerun_cpp/src/rerun/archetypes/annotation_context.cpp @@ -9,16 +9,16 @@ namespace rerun { namespace archetypes { - arrow::Result> AnnotationContext::to_data_cells() const { + Result> AnnotationContext::to_data_cells() const { std::vector cells; cells.reserve(1); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::AnnotationContext::to_data_cell(&context, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::AnnotationContext::to_data_cell(&context, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/annotation_context.hpp b/rerun_cpp/src/rerun/archetypes/annotation_context.hpp index 0378cc4ee37d..ff57e3051b9b 100644 --- a/rerun_cpp/src/rerun/archetypes/annotation_context.hpp +++ b/rerun_cpp/src/rerun/archetypes/annotation_context.hpp @@ -5,6 +5,7 @@ #include "../components/annotation_context.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -65,7 +66,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/arrows3d.cpp b/rerun_cpp/src/rerun/archetypes/arrows3d.cpp index e1c39fad68db..08404e2524db 100644 --- a/rerun_cpp/src/rerun/archetypes/arrows3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/arrows3d.cpp @@ -15,64 +15,71 @@ namespace rerun { namespace archetypes { - arrow::Result> Arrows3D::to_data_cells() const { + Result> Arrows3D::to_data_cells() const { std::vector cells; cells.reserve(7); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Vector3D::to_data_cell(vectors.data(), vectors.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Vector3D::to_data_cell(vectors.data(), vectors.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (origins.has_value()) { const auto& value = origins.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Origin3D::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Origin3D::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (radii.has_value()) { const auto& value = radii.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Radius::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Radius::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (colors.has_value()) { const auto& value = colors.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Color::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Color::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (labels.has_value()) { const auto& value = labels.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Label::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Label::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (class_ids.has_value()) { const auto& value = class_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::ClassId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::ClassId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (instance_keys.has_value()) { const auto& value = instance_keys.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::InstanceKey::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::InstanceKey::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/arrows3d.hpp b/rerun_cpp/src/rerun/archetypes/arrows3d.hpp index 4bc189642d40..7fe58c605de2 100644 --- a/rerun_cpp/src/rerun/archetypes/arrows3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/arrows3d.hpp @@ -11,6 +11,7 @@ #include "../components/radius.hpp" #include "../components/vector3d.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -177,7 +178,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp index 24bdc388d563..4bc18fec67d9 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.cpp @@ -9,16 +9,17 @@ namespace rerun { namespace archetypes { - arrow::Result> DisconnectedSpace::to_data_cells() const { + Result> DisconnectedSpace::to_data_cells() const { std::vector cells; cells.reserve(1); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::DisconnectedSpace::to_data_cell(&disconnected_space, 1) - ); - cells.push_back(cell); + const auto result = + rerun::components::DisconnectedSpace::to_data_cell(&disconnected_space, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp index 23548f0b0500..f48bbc0a006d 100644 --- a/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/archetypes/disconnected_space.hpp @@ -5,6 +5,7 @@ #include "../components/disconnected_space.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -65,7 +66,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/line_strips2d.cpp b/rerun_cpp/src/rerun/archetypes/line_strips2d.cpp index e1abcc275422..4dc7bd75a1bc 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips2d.cpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips2d.cpp @@ -15,64 +15,70 @@ namespace rerun { namespace archetypes { - arrow::Result> LineStrips2D::to_data_cells() const { + Result> LineStrips2D::to_data_cells() const { std::vector cells; cells.reserve(7); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::LineStrip2D::to_data_cell(strips.data(), strips.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::LineStrip2D::to_data_cell(strips.data(), strips.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (radii.has_value()) { const auto& value = radii.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Radius::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Radius::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (colors.has_value()) { const auto& value = colors.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Color::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Color::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (labels.has_value()) { const auto& value = labels.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Label::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Label::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (draw_order.has_value()) { const auto& value = draw_order.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::DrawOrder::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::DrawOrder::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (class_ids.has_value()) { const auto& value = class_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::ClassId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::ClassId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (instance_keys.has_value()) { const auto& value = instance_keys.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::InstanceKey::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::InstanceKey::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp index 87851178b295..91265086c051 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips2d.hpp @@ -11,6 +11,7 @@ #include "../components/line_strip2d.hpp" #include "../components/radius.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -182,7 +183,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/line_strips3d.cpp b/rerun_cpp/src/rerun/archetypes/line_strips3d.cpp index c90dd2eabdfa..a1ce2ed0dd2c 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips3d.cpp @@ -14,56 +14,62 @@ namespace rerun { namespace archetypes { - arrow::Result> LineStrips3D::to_data_cells() const { + Result> LineStrips3D::to_data_cells() const { std::vector cells; cells.reserve(6); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::LineStrip3D::to_data_cell(strips.data(), strips.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::LineStrip3D::to_data_cell(strips.data(), strips.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (radii.has_value()) { const auto& value = radii.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Radius::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Radius::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (colors.has_value()) { const auto& value = colors.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Color::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Color::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (labels.has_value()) { const auto& value = labels.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Label::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Label::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (class_ids.has_value()) { const auto& value = class_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::ClassId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::ClassId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (instance_keys.has_value()) { const auto& value = instance_keys.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::InstanceKey::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::InstanceKey::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp b/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp index a18bcc82599f..cb8a227733da 100644 --- a/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/line_strips3d.hpp @@ -10,6 +10,7 @@ #include "../components/line_strip3d.hpp" #include "../components/radius.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -187,7 +188,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/points2d.cpp b/rerun_cpp/src/rerun/archetypes/points2d.cpp index 405b6077f015..510fa375abee 100644 --- a/rerun_cpp/src/rerun/archetypes/points2d.cpp +++ b/rerun_cpp/src/rerun/archetypes/points2d.cpp @@ -16,72 +16,79 @@ namespace rerun { namespace archetypes { - arrow::Result> Points2D::to_data_cells() const { + Result> Points2D::to_data_cells() const { std::vector cells; cells.reserve(8); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Point2D::to_data_cell(points.data(), points.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Point2D::to_data_cell(points.data(), points.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (radii.has_value()) { const auto& value = radii.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Radius::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Radius::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (colors.has_value()) { const auto& value = colors.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Color::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Color::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (labels.has_value()) { const auto& value = labels.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Label::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Label::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (draw_order.has_value()) { const auto& value = draw_order.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::DrawOrder::to_data_cell(&value, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::DrawOrder::to_data_cell(&value, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (class_ids.has_value()) { const auto& value = class_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::ClassId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::ClassId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (keypoint_ids.has_value()) { const auto& value = keypoint_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::KeypointId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::KeypointId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (instance_keys.has_value()) { const auto& value = instance_keys.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::InstanceKey::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::InstanceKey::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/points2d.hpp b/rerun_cpp/src/rerun/archetypes/points2d.hpp index 2f396241cb79..28494c564b81 100644 --- a/rerun_cpp/src/rerun/archetypes/points2d.hpp +++ b/rerun_cpp/src/rerun/archetypes/points2d.hpp @@ -12,6 +12,7 @@ #include "../components/point2d.hpp" #include "../components/radius.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -170,7 +171,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/points3d.cpp b/rerun_cpp/src/rerun/archetypes/points3d.cpp index d8f4edf529d5..da9ec6b80187 100644 --- a/rerun_cpp/src/rerun/archetypes/points3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/points3d.cpp @@ -15,64 +15,71 @@ namespace rerun { namespace archetypes { - arrow::Result> Points3D::to_data_cells() const { + Result> Points3D::to_data_cells() const { std::vector cells; cells.reserve(7); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Point3D::to_data_cell(points.data(), points.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Point3D::to_data_cell(points.data(), points.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (radii.has_value()) { const auto& value = radii.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Radius::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Radius::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (colors.has_value()) { const auto& value = colors.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Color::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Color::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (labels.has_value()) { const auto& value = labels.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Label::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::Label::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (class_ids.has_value()) { const auto& value = class_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::ClassId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::ClassId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (keypoint_ids.has_value()) { const auto& value = keypoint_ids.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::KeypointId::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::KeypointId::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } if (instance_keys.has_value()) { const auto& value = instance_keys.value(); - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::InstanceKey::to_data_cell(value.data(), value.size()) - ); - cells.push_back(cell); + const auto result = + rerun::components::InstanceKey::to_data_cell(value.data(), value.size()); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/points3d.hpp b/rerun_cpp/src/rerun/archetypes/points3d.hpp index 0f53488f0765..005af951f625 100644 --- a/rerun_cpp/src/rerun/archetypes/points3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/points3d.hpp @@ -11,6 +11,7 @@ #include "../components/point3d.hpp" #include "../components/radius.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -172,7 +173,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.cpp b/rerun_cpp/src/rerun/archetypes/transform3d.cpp index 58e469de42e3..973c6ed8192d 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.cpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.cpp @@ -9,16 +9,16 @@ namespace rerun { namespace archetypes { - arrow::Result> Transform3D::to_data_cells() const { + Result> Transform3D::to_data_cells() const { std::vector cells; cells.reserve(1); { - ARROW_ASSIGN_OR_RAISE( - const auto cell, - rerun::components::Transform3D::to_data_cell(&transform, 1) - ); - cells.push_back(cell); + const auto result = rerun::components::Transform3D::to_data_cell(&transform, 1); + if (result.is_err()) { + return result.error; + } + cells.emplace_back(std::move(result.value)); } return cells; diff --git a/rerun_cpp/src/rerun/archetypes/transform3d.hpp b/rerun_cpp/src/rerun/archetypes/transform3d.hpp index 4f3b33e3561e..34521fce0a47 100644 --- a/rerun_cpp/src/rerun/archetypes/transform3d.hpp +++ b/rerun_cpp/src/rerun/archetypes/transform3d.hpp @@ -5,6 +5,7 @@ #include "../components/transform3d.hpp" #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -242,7 +243,7 @@ namespace rerun { } /// Creates a list of Rerun DataCell from this archetype. - arrow::Result> to_data_cells() const; + Result> to_data_cells() const; }; } // namespace archetypes } // namespace rerun diff --git a/rerun_cpp/src/rerun/arrow.cpp b/rerun_cpp/src/rerun/arrow.cpp index a3256f975cee..24f547b61227 100644 --- a/rerun_cpp/src/rerun/arrow.cpp +++ b/rerun_cpp/src/rerun/arrow.cpp @@ -5,11 +5,17 @@ #include namespace rerun { - arrow::Result> ipc_from_table(const arrow::Table& table) { + Result> ipc_from_table(const arrow::Table& table) { ARROW_ASSIGN_OR_RAISE(auto output, arrow::io::BufferOutputStream::Create()); ARROW_ASSIGN_OR_RAISE(auto writer, arrow::ipc::MakeStreamWriter(output, table.schema())); ARROW_RETURN_NOT_OK(writer->WriteTable(table)); ARROW_RETURN_NOT_OK(writer->Close()); - return output->Finish(); + + auto result = output->Finish(); + if (result.ok()) { + return result.ValueOrDie(); + } else { + return result.status(); + } } } // namespace rerun diff --git a/rerun_cpp/src/rerun/arrow.hpp b/rerun_cpp/src/rerun/arrow.hpp index 1193ec5a422d..08726c12f11c 100644 --- a/rerun_cpp/src/rerun/arrow.hpp +++ b/rerun_cpp/src/rerun/arrow.hpp @@ -1,12 +1,18 @@ // Arrow integrations. #pragma once -#include +#include +#include "result.hpp" + +namespace arrow { + class Buffer; + class Table; +} // namespace arrow namespace rerun { /// Encode the given arrow table in the Arrow IPC encapsulated message format. /// /// * /// * - arrow::Result> ipc_from_table(const arrow::Table& table); + Result> ipc_from_table(const arrow::Table& table); } // namespace rerun diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer1.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer1.cpp index 29e5698ec7d8..a84d94288766 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer1.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer1.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer1::to_data_cell( + Result AffixFuzzer1::to_data_cell( const AffixFuzzer1 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer1::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer1.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer1.hpp index 468985a90020..e247503b9ca6 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer1.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer1.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer1 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer1* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer10.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer10.cpp index 9756bf3fde15..edef0c972001 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer10.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer10.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer10::to_data_cell( + Result AffixFuzzer10::to_data_cell( const AffixFuzzer10* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer10::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer10.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer10.hpp index 6a505a4f97e9..cca1b18c6e4b 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer10.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer10.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -44,7 +45,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer10 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer10* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer11.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer11.cpp index 853e2f9912ef..ffe8314948c9 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer11.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer11.cpp @@ -60,7 +60,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer11::to_data_cell( + Result AffixFuzzer11::to_data_cell( const AffixFuzzer11 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -81,10 +81,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer11::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer11.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer11.hpp index caa56f332a8e..f1318d90d67d 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer11.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer11.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -44,7 +45,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer11 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer11* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer12.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer12.cpp index 45cb19086d6f..c7a61f2dcb21 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer12.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer12.cpp @@ -57,7 +57,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer12::to_data_cell( + Result AffixFuzzer12::to_data_cell( const AffixFuzzer12 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -78,10 +78,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer12::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer12.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer12.hpp index edb339008c6e..bde754f030f5 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer12.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer12.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -44,7 +45,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer12 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer12* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer13.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer13.cpp index 3e9a3acdcc66..1ae1bba2d1e5 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer13.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer13.cpp @@ -62,7 +62,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer13::to_data_cell( + Result AffixFuzzer13::to_data_cell( const AffixFuzzer13 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -83,10 +83,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer13::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer13.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer13.hpp index 16087ef0b209..4e957610d58a 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer13.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer13.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -46,7 +47,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer13 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer13* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer14.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer14.cpp index 6e194784e91b..67ab86f58bfc 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer14.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer14.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer14::to_data_cell( + Result AffixFuzzer14::to_data_cell( const AffixFuzzer14 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -69,10 +69,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer14::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer14.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer14.hpp index eb6b627fb361..ced624ca86e0 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer14.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer14.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer3.hpp" +#include "../result.hpp" #include #include @@ -44,7 +45,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer14 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer14* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer15.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer15.cpp index 485151add7bb..b48b1a0567ca 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer15.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer15.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer15::to_data_cell( + Result AffixFuzzer15::to_data_cell( const AffixFuzzer15* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -65,10 +65,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer15::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer15.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer15.hpp index ad735be1adcc..5cae9f13f913 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer15.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer15.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer3.hpp" +#include "../result.hpp" #include #include @@ -47,7 +48,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer15 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer15* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer16.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer16.cpp index d8d07bf4a5f8..df138bb49570 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer16.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer16.cpp @@ -61,7 +61,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer16::to_data_cell( + Result AffixFuzzer16::to_data_cell( const AffixFuzzer16 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -82,10 +82,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer16::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer16.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer16.hpp index 90c7f9e3eb71..19dee4b34f17 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer16.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer16.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer3.hpp" +#include "../result.hpp" #include #include @@ -46,7 +47,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer16 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer16* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer17.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer17.cpp index d156ac96e38e..8efeaca049e5 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer17.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer17.cpp @@ -67,7 +67,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer17::to_data_cell( + Result AffixFuzzer17::to_data_cell( const AffixFuzzer17 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -88,10 +88,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer17::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer17.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer17.hpp index 4001c1ff9e5a..1faeff9841ca 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer17.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer17.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer3.hpp" +#include "../result.hpp" #include #include @@ -49,7 +50,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer17 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer17* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer18.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer18.cpp index 22559ab7356a..08363670dba5 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer18.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer18.cpp @@ -67,7 +67,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer18::to_data_cell( + Result AffixFuzzer18::to_data_cell( const AffixFuzzer18 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -88,10 +88,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer18::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer18.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer18.hpp index 8797600fe2f3..b516f078f9ea 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer18.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer18.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer4.hpp" +#include "../result.hpp" #include #include @@ -49,7 +50,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer18 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer18* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer19.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer19.cpp index 2c6fdf88b2f2..d63d642611e0 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer19.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer19.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer19::to_data_cell( + Result AffixFuzzer19::to_data_cell( const AffixFuzzer19 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer19::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer19.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer19.hpp index 9580245f02b7..c35bd358d805 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer19.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer19.hpp @@ -6,6 +6,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer4.hpp" #include "../datatypes/affix_fuzzer5.hpp" +#include "../result.hpp" #include #include @@ -48,7 +49,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer19 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer19* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer2.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer2.cpp index b824673e5cd9..392ce3a438d2 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer2.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer2.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer2::to_data_cell( + Result AffixFuzzer2::to_data_cell( const AffixFuzzer2 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer2::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer2.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer2.hpp index b0ae43e9347f..624a7442b783 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer2.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer2.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer2 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer2* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer20.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer20.cpp index 4a405cda5ce6..9d1a3709bd76 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer20.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer20.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer20::to_data_cell( + Result AffixFuzzer20::to_data_cell( const AffixFuzzer20 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer20::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer20.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer20.hpp index a6daf377f524..5352ff82bd76 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer20.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer20.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer20.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer20 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer20* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer3.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer3.cpp index 8dda58e1be11..97bbac30d617 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer3.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer3.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer3::to_data_cell( + Result AffixFuzzer3::to_data_cell( const AffixFuzzer3 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer3::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer3.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer3.hpp index 1b82334d9a04..8c2bf23d6761 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer3.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer3.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer3 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer3* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer4.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer4.cpp index cf075a512221..d8ed58bfe665 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer4.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer4.cpp @@ -45,7 +45,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer4::to_data_cell( + Result AffixFuzzer4::to_data_cell( const AffixFuzzer4* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -66,10 +66,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer4::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer4.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer4.hpp index e4e4299a83bf..4fb524435d43 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer4.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer4.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -45,7 +46,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer4 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer4* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer5.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer5.cpp index ca367a4a6d19..157390bc7255 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer5.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer5.cpp @@ -45,7 +45,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer5::to_data_cell( + Result AffixFuzzer5::to_data_cell( const AffixFuzzer5* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -66,10 +66,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer5::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer5.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer5.hpp index f1f804aed5e1..ce7ff72ee8e4 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer5.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer5.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -45,7 +46,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer5 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer5* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer6.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer6.cpp index 0ee4e5e58645..9afaaf66964e 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer6.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer6.cpp @@ -45,7 +45,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer6::to_data_cell( + Result AffixFuzzer6::to_data_cell( const AffixFuzzer6* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -66,10 +66,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer6::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer6.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer6.hpp index bdfb4cb26a03..e987b5810148 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer6.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer6.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -45,7 +46,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer6 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer6* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer7.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer7.cpp index d703b33818c5..1abdcf80abe8 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer7.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer7.cpp @@ -67,7 +67,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer7::to_data_cell( + Result AffixFuzzer7::to_data_cell( const AffixFuzzer7 *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -88,10 +88,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer7::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer7.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer7.hpp index 854b00c4f9c4..cf471ba7b4dd 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer7.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer7.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/affix_fuzzer1.hpp" +#include "../result.hpp" #include #include @@ -47,7 +48,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer7 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer7* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer8.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer8.cpp index 09f6bf13e60b..4ee03ea7ae61 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer8.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer8.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer8::to_data_cell( + Result AffixFuzzer8::to_data_cell( const AffixFuzzer8* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer8::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer8.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer8.hpp index 884d4b6da20c..b7e9e6da7b6b 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer8.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer8.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer8 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer8* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer9.cpp b/rerun_cpp/src/rerun/components/affix_fuzzer9.cpp index 53862d2a8e5f..ea213a280401 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer9.cpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer9.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AffixFuzzer9::to_data_cell( + Result AffixFuzzer9::to_data_cell( const AffixFuzzer9* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -65,10 +65,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AffixFuzzer9::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/affix_fuzzer9.hpp b/rerun_cpp/src/rerun/components/affix_fuzzer9.hpp index 151e19818498..eedfda3db2f2 100644 --- a/rerun_cpp/src/rerun/components/affix_fuzzer9.hpp +++ b/rerun_cpp/src/rerun/components/affix_fuzzer9.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -43,7 +44,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AffixFuzzer9 components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AffixFuzzer9* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/annotation_context.cpp b/rerun_cpp/src/rerun/components/annotation_context.cpp index c887e714272f..fa65343bfe02 100644 --- a/rerun_cpp/src/rerun/components/annotation_context.cpp +++ b/rerun_cpp/src/rerun/components/annotation_context.cpp @@ -65,7 +65,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result AnnotationContext::to_data_cell( + Result AnnotationContext::to_data_cell( const AnnotationContext *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -90,10 +90,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = AnnotationContext::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/annotation_context.hpp b/rerun_cpp/src/rerun/components/annotation_context.hpp index 85031bd668e0..4d672337d92d 100644 --- a/rerun_cpp/src/rerun/components/annotation_context.hpp +++ b/rerun_cpp/src/rerun/components/annotation_context.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/class_description_map_elem.hpp" +#include "../result.hpp" #include #include @@ -65,7 +66,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of AnnotationContext components. - static arrow::Result to_data_cell( + static Result to_data_cell( const AnnotationContext* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/class_id.cpp b/rerun_cpp/src/rerun/components/class_id.cpp index 82e50f747ac0..968b449b5c40 100644 --- a/rerun_cpp/src/rerun/components/class_id.cpp +++ b/rerun_cpp/src/rerun/components/class_id.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result ClassId::to_data_cell( + Result ClassId::to_data_cell( const ClassId *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -69,10 +69,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = ClassId::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/class_id.hpp b/rerun_cpp/src/rerun/components/class_id.hpp index 928050ab864b..3894e51e8c70 100644 --- a/rerun_cpp/src/rerun/components/class_id.hpp +++ b/rerun_cpp/src/rerun/components/class_id.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/class_id.hpp" +#include "../result.hpp" #include #include @@ -45,7 +46,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of ClassId components. - static arrow::Result to_data_cell( + static Result to_data_cell( const ClassId* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/color.cpp b/rerun_cpp/src/rerun/components/color.cpp index 1d20da48f8f2..471b4c40adcd 100644 --- a/rerun_cpp/src/rerun/components/color.cpp +++ b/rerun_cpp/src/rerun/components/color.cpp @@ -49,9 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Color::to_data_cell( - const Color *instances, size_t num_instances - ) { + Result Color::to_data_cell(const Color *instances, size_t num_instances) { // TODO(andreas): Allow configuring the memory pool. arrow::MemoryPool *pool = arrow::default_memory_pool(); @@ -69,10 +67,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Color::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/color.hpp b/rerun_cpp/src/rerun/components/color.hpp index d5210c4c17f3..bbce5ce479aa 100644 --- a/rerun_cpp/src/rerun/components/color.hpp +++ b/rerun_cpp/src/rerun/components/color.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/color.hpp" +#include "../result.hpp" #include #include @@ -68,7 +69,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Color components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Color* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/disconnected_space.cpp b/rerun_cpp/src/rerun/components/disconnected_space.cpp index a4728bcfb08b..89990633a0b5 100644 --- a/rerun_cpp/src/rerun/components/disconnected_space.cpp +++ b/rerun_cpp/src/rerun/components/disconnected_space.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result DisconnectedSpace::to_data_cell( + Result DisconnectedSpace::to_data_cell( const DisconnectedSpace *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -69,10 +69,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = DisconnectedSpace::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/disconnected_space.hpp b/rerun_cpp/src/rerun/components/disconnected_space.hpp index 5562d8d579d5..858f34b0807a 100644 --- a/rerun_cpp/src/rerun/components/disconnected_space.hpp +++ b/rerun_cpp/src/rerun/components/disconnected_space.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -48,7 +49,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of DisconnectedSpace components. - static arrow::Result to_data_cell( + static Result to_data_cell( const DisconnectedSpace* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/draw_order.cpp b/rerun_cpp/src/rerun/components/draw_order.cpp index 79b4124d0308..96f4906f41ab 100644 --- a/rerun_cpp/src/rerun/components/draw_order.cpp +++ b/rerun_cpp/src/rerun/components/draw_order.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result DrawOrder::to_data_cell( + Result DrawOrder::to_data_cell( const DrawOrder* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -65,10 +65,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = DrawOrder::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/draw_order.hpp b/rerun_cpp/src/rerun/components/draw_order.hpp index 8ac4bef3db37..dd78325d7839 100644 --- a/rerun_cpp/src/rerun/components/draw_order.hpp +++ b/rerun_cpp/src/rerun/components/draw_order.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -48,7 +49,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of DrawOrder components. - static arrow::Result to_data_cell( + static Result to_data_cell( const DrawOrder* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/instance_key.cpp b/rerun_cpp/src/rerun/components/instance_key.cpp index f3bf53f774dd..66e82b03e517 100644 --- a/rerun_cpp/src/rerun/components/instance_key.cpp +++ b/rerun_cpp/src/rerun/components/instance_key.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result InstanceKey::to_data_cell( + Result InstanceKey::to_data_cell( const InstanceKey* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -65,10 +65,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = InstanceKey::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/instance_key.hpp b/rerun_cpp/src/rerun/components/instance_key.hpp index bca7679c84a8..77f8064be71a 100644 --- a/rerun_cpp/src/rerun/components/instance_key.hpp +++ b/rerun_cpp/src/rerun/components/instance_key.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -42,7 +43,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of InstanceKey components. - static arrow::Result to_data_cell( + static Result to_data_cell( const InstanceKey* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/keypoint_id.cpp b/rerun_cpp/src/rerun/components/keypoint_id.cpp index 69ecd35f65f2..4bc3997a1cd2 100644 --- a/rerun_cpp/src/rerun/components/keypoint_id.cpp +++ b/rerun_cpp/src/rerun/components/keypoint_id.cpp @@ -49,7 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result KeypointId::to_data_cell( + Result KeypointId::to_data_cell( const KeypointId *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -70,10 +70,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = KeypointId::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/keypoint_id.hpp b/rerun_cpp/src/rerun/components/keypoint_id.hpp index 8f741d2ad923..0f632b03b2e4 100644 --- a/rerun_cpp/src/rerun/components/keypoint_id.hpp +++ b/rerun_cpp/src/rerun/components/keypoint_id.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/keypoint_id.hpp" +#include "../result.hpp" #include #include @@ -45,7 +46,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of KeypointId components. - static arrow::Result to_data_cell( + static Result to_data_cell( const KeypointId* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/label.cpp b/rerun_cpp/src/rerun/components/label.cpp index f9941e1e803a..171ff969bb58 100644 --- a/rerun_cpp/src/rerun/components/label.cpp +++ b/rerun_cpp/src/rerun/components/label.cpp @@ -49,9 +49,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Label::to_data_cell( - const Label *instances, size_t num_instances - ) { + Result Label::to_data_cell(const Label *instances, size_t num_instances) { // TODO(andreas): Allow configuring the memory pool. arrow::MemoryPool *pool = arrow::default_memory_pool(); @@ -69,10 +67,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Label::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/label.hpp b/rerun_cpp/src/rerun/components/label.hpp index f44129a9b657..e1f2fd06750a 100644 --- a/rerun_cpp/src/rerun/components/label.hpp +++ b/rerun_cpp/src/rerun/components/label.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/label.hpp" +#include "../result.hpp" #include #include @@ -56,7 +57,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Label components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Label* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/line_strip2d.cpp b/rerun_cpp/src/rerun/components/line_strip2d.cpp index f47740d84fb0..a32ee33415f7 100644 --- a/rerun_cpp/src/rerun/components/line_strip2d.cpp +++ b/rerun_cpp/src/rerun/components/line_strip2d.cpp @@ -62,7 +62,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result LineStrip2D::to_data_cell( + Result LineStrip2D::to_data_cell( const LineStrip2D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -83,10 +83,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = LineStrip2D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/line_strip2d.hpp b/rerun_cpp/src/rerun/components/line_strip2d.hpp index 302d1b78c9a8..8039c1652e2d 100644 --- a/rerun_cpp/src/rerun/components/line_strip2d.hpp +++ b/rerun_cpp/src/rerun/components/line_strip2d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec2d.hpp" +#include "../result.hpp" #include #include @@ -56,7 +57,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of LineStrip2D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const LineStrip2D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/line_strip3d.cpp b/rerun_cpp/src/rerun/components/line_strip3d.cpp index 2a99fce3fd02..2a923e660a8c 100644 --- a/rerun_cpp/src/rerun/components/line_strip3d.cpp +++ b/rerun_cpp/src/rerun/components/line_strip3d.cpp @@ -62,7 +62,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result LineStrip3D::to_data_cell( + Result LineStrip3D::to_data_cell( const LineStrip3D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -83,10 +83,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = LineStrip3D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/line_strip3d.hpp b/rerun_cpp/src/rerun/components/line_strip3d.hpp index 7af2bfa374d5..1b7941b1c555 100644 --- a/rerun_cpp/src/rerun/components/line_strip3d.hpp +++ b/rerun_cpp/src/rerun/components/line_strip3d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec3d.hpp" +#include "../result.hpp" #include #include @@ -56,7 +57,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of LineStrip3D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const LineStrip3D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/origin3d.cpp b/rerun_cpp/src/rerun/components/origin3d.cpp index 0d773795f0fe..25452711151c 100644 --- a/rerun_cpp/src/rerun/components/origin3d.cpp +++ b/rerun_cpp/src/rerun/components/origin3d.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Origin3D::to_data_cell( + Result Origin3D::to_data_cell( const Origin3D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -68,10 +68,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Origin3D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/origin3d.hpp b/rerun_cpp/src/rerun/components/origin3d.hpp index fadedf2e2ac7..1f7560210370 100644 --- a/rerun_cpp/src/rerun/components/origin3d.hpp +++ b/rerun_cpp/src/rerun/components/origin3d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec3d.hpp" +#include "../result.hpp" #include #include @@ -62,7 +63,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Origin3D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Origin3D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/point2d.cpp b/rerun_cpp/src/rerun/components/point2d.cpp index 5009cf248124..d2f1c5f91c1b 100644 --- a/rerun_cpp/src/rerun/components/point2d.cpp +++ b/rerun_cpp/src/rerun/components/point2d.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Point2D::to_data_cell( + Result Point2D::to_data_cell( const Point2D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -68,10 +68,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Point2D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/point2d.hpp b/rerun_cpp/src/rerun/components/point2d.hpp index 4702f0467c5c..e5d3438ca4c7 100644 --- a/rerun_cpp/src/rerun/components/point2d.hpp +++ b/rerun_cpp/src/rerun/components/point2d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec2d.hpp" +#include "../result.hpp" #include #include @@ -58,7 +59,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Point2D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Point2D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/point3d.cpp b/rerun_cpp/src/rerun/components/point3d.cpp index 61ca1187f323..51237fcc99be 100644 --- a/rerun_cpp/src/rerun/components/point3d.cpp +++ b/rerun_cpp/src/rerun/components/point3d.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Point3D::to_data_cell( + Result Point3D::to_data_cell( const Point3D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -68,10 +68,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Point3D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/point3d.hpp b/rerun_cpp/src/rerun/components/point3d.hpp index 50b1698aa1cb..12394f9fb66e 100644 --- a/rerun_cpp/src/rerun/components/point3d.hpp +++ b/rerun_cpp/src/rerun/components/point3d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec3d.hpp" +#include "../result.hpp" #include #include @@ -62,7 +63,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Point3D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Point3D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/radius.cpp b/rerun_cpp/src/rerun/components/radius.cpp index 4dd1f9b6f4cf..f56401d28437 100644 --- a/rerun_cpp/src/rerun/components/radius.cpp +++ b/rerun_cpp/src/rerun/components/radius.cpp @@ -44,7 +44,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Radius::to_data_cell( + Result Radius::to_data_cell( const Radius* instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -64,10 +64,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Radius::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/radius.hpp b/rerun_cpp/src/rerun/components/radius.hpp index e7b1b73f73e6..2ed644eccc21 100644 --- a/rerun_cpp/src/rerun/components/radius.hpp +++ b/rerun_cpp/src/rerun/components/radius.hpp @@ -4,6 +4,7 @@ #pragma once #include "../data_cell.hpp" +#include "../result.hpp" #include #include @@ -42,7 +43,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Radius components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Radius* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/transform3d.cpp b/rerun_cpp/src/rerun/components/transform3d.cpp index 72e86046ba19..033e6fb09a0a 100644 --- a/rerun_cpp/src/rerun/components/transform3d.cpp +++ b/rerun_cpp/src/rerun/components/transform3d.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Transform3D::to_data_cell( + Result Transform3D::to_data_cell( const Transform3D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -69,10 +69,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Transform3D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/transform3d.hpp b/rerun_cpp/src/rerun/components/transform3d.hpp index cfd217261daa..3ccae80b5022 100644 --- a/rerun_cpp/src/rerun/components/transform3d.hpp +++ b/rerun_cpp/src/rerun/components/transform3d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/transform3d.hpp" +#include "../result.hpp" #include #include @@ -44,7 +45,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Transform3D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Transform3D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/components/vector3d.cpp b/rerun_cpp/src/rerun/components/vector3d.cpp index 8a89cf5b18b3..0e3ee6862754 100644 --- a/rerun_cpp/src/rerun/components/vector3d.cpp +++ b/rerun_cpp/src/rerun/components/vector3d.cpp @@ -48,7 +48,7 @@ namespace rerun { return arrow::Status::OK(); } - arrow::Result Vector3D::to_data_cell( + Result Vector3D::to_data_cell( const Vector3D *instances, size_t num_instances ) { // TODO(andreas): Allow configuring the memory pool. @@ -68,10 +68,11 @@ namespace rerun { rerun::DataCell cell; cell.component_name = Vector3D::NAME; - ARROW_ASSIGN_OR_RAISE( - cell.buffer, - rerun::ipc_from_table(*arrow::Table::Make(schema, {array})) - ); + const auto result = rerun::ipc_from_table(*arrow::Table::Make(schema, {array})); + if (result.is_err()) { + return result.error; + } + cell.buffer = std::move(result.value); return cell; } diff --git a/rerun_cpp/src/rerun/components/vector3d.hpp b/rerun_cpp/src/rerun/components/vector3d.hpp index c4bedf80d24b..73e1ffc7e996 100644 --- a/rerun_cpp/src/rerun/components/vector3d.hpp +++ b/rerun_cpp/src/rerun/components/vector3d.hpp @@ -5,6 +5,7 @@ #include "../data_cell.hpp" #include "../datatypes/vec3d.hpp" +#include "../result.hpp" #include #include @@ -62,7 +63,7 @@ namespace rerun { ); /// Creates a Rerun DataCell from an array of Vector3D components. - static arrow::Result to_data_cell( + static Result to_data_cell( const Vector3D* instances, size_t num_instances ); }; diff --git a/rerun_cpp/src/rerun/error.cpp b/rerun_cpp/src/rerun/error.cpp index 3d52affcc900..04d2e871fef1 100644 --- a/rerun_cpp/src/rerun/error.cpp +++ b/rerun_cpp/src/rerun/error.cpp @@ -1,5 +1,6 @@ #include "error.hpp" +#include #include namespace rerun { @@ -9,6 +10,66 @@ namespace rerun { Error::Error(const rr_error& status) : code(static_cast(status.code)), description(status.description) {} + Error::Error(const arrow::Status& status) { + switch (status.code()) { + case arrow::StatusCode::OK: + code = ErrorCode::Ok; + break; + case arrow::StatusCode::OutOfMemory: + code = ErrorCode::OutOfMemory; + break; + case arrow::StatusCode::KeyError: + code = ErrorCode::ArrowStatusCode_KeyError; + break; + case arrow::StatusCode::TypeError: + code = ErrorCode::ArrowStatusCode_TypeError; + break; + case arrow::StatusCode::Invalid: + code = ErrorCode::ArrowStatusCode_Invalid; + break; + case arrow::StatusCode::IOError: + code = ErrorCode::ArrowStatusCode_IOError; + break; + case arrow::StatusCode::CapacityError: + code = ErrorCode::ArrowStatusCode_CapacityError; + break; + case arrow::StatusCode::IndexError: + code = ErrorCode::ArrowStatusCode_IndexError; + break; + case arrow::StatusCode::Cancelled: + code = ErrorCode::ArrowStatusCode_Cancelled; + break; + case arrow::StatusCode::UnknownError: + code = ErrorCode::ArrowStatusCode_UnknownError; + break; + case arrow::StatusCode::NotImplemented: + code = ErrorCode::ArrowStatusCode_NotImplemented; + break; + case arrow::StatusCode::SerializationError: + code = ErrorCode::ArrowStatusCode_SerializationError; + break; + case arrow::StatusCode::RError: + code = ErrorCode::ArrowStatusCode_RError; + break; + case arrow::StatusCode::CodeGenError: + code = ErrorCode::ArrowStatusCode_CodeGenError; + break; + case arrow::StatusCode::ExpressionValidationError: + code = ErrorCode::ArrowStatusCode_ExpressionValidationError; + break; + case arrow::StatusCode::ExecutionError: + code = ErrorCode::ArrowStatusCode_ExecutionError; + break; + case arrow::StatusCode::AlreadyExists: + code = ErrorCode::ArrowStatusCode_AlreadyExists; + break; + default: + code = ErrorCode::Unknown; + break; + } + description = status.message(); + } + void Error::set_log_handler(StatusLogHandler handler, void* userdata) { global_log_handler = handler; global_log_handler_user_data = userdata; diff --git a/rerun_cpp/src/rerun/error.hpp b/rerun_cpp/src/rerun/error.hpp index 894e75f2ff8a..f69bc0d28133 100644 --- a/rerun_cpp/src/rerun/error.hpp +++ b/rerun_cpp/src/rerun/error.hpp @@ -7,6 +7,10 @@ #include #endif +namespace arrow { + class Status; +} + struct rr_error; namespace rerun { @@ -15,9 +19,10 @@ namespace rerun { /// Category codes are used to group errors together, but are never returned directly. enum class ErrorCode : uint32_t { Ok = 0, + OutOfMemory = 1, // Invalid argument errors. - _CategoryArgument = 0x000000010, + _CategoryArgument = 0x0000'0010, UnexpectedNullArgument, InvalidStringArgument, InvalidRecordingStreamHandle, @@ -25,16 +30,34 @@ namespace rerun { InvalidEntityPath, // Recording stream errors - _CategoryRecordingStream = 0x000000100, + _CategoryRecordingStream = 0x0000'0100, RecordingStreamCreationFailure, RecordingStreamSaveFailure, // Arrow data processing errors. - _CategoryArrow = 0x000001000, + _CategoryArrow = 0x0000'1000, ArrowIpcMessageParsingFailure, ArrowDataCellError, - Unknown = 0xFFFFFFFF, + // Errors directly translated from arrow::StatusCode. + _CategoryArrowCppStatus = 0x1000'0000, + ArrowStatusCode_KeyError, + ArrowStatusCode_TypeError, + ArrowStatusCode_Invalid, + ArrowStatusCode_IOError, + ArrowStatusCode_CapacityError, + ArrowStatusCode_IndexError, + ArrowStatusCode_Cancelled, + ArrowStatusCode_UnknownError, + ArrowStatusCode_NotImplemented, + ArrowStatusCode_SerializationError, + ArrowStatusCode_RError, + ArrowStatusCode_CodeGenError, + ArrowStatusCode_ExpressionValidationError, + ArrowStatusCode_ExecutionError, + ArrowStatusCode_AlreadyExists, + + Unknown = 0xFFFF'FFFF, }; /// Callback function type for log handlers. @@ -60,6 +83,14 @@ namespace rerun { /// Construct from a C status object. Error(const rr_error& status); + /// Construct from an arrow status. + Error(const arrow::Status& status); + + /// Compare two errors for equality. Requires the description to match. + bool operator==(const Error& other) const { + return code == other.code && description == other.description; + } + /// Returns true if the code is `Ok`. bool is_ok() const { return code == ErrorCode::Ok; diff --git a/rerun_cpp/src/rerun/recording_stream.hpp b/rerun_cpp/src/rerun/recording_stream.hpp index 88f85fe3096e..793d1714ecca 100644 --- a/rerun_cpp/src/rerun/recording_stream.hpp +++ b/rerun_cpp/src/rerun/recording_stream.hpp @@ -7,9 +7,6 @@ #include "data_cell.hpp" #include "error.hpp" -// TODO(#2873): Should avoid leaking arrow headers. -#include - namespace rerun { struct DataCell; @@ -146,13 +143,17 @@ namespace rerun { /// @see log_archetype template Error try_log_archetype(const char* entity_path, const T& archetype) { - const auto data_cells = archetype.to_data_cells().ValueOrDie(); // TODO: Error handling. - return try_log_data_row( - entity_path, - archetype.num_instances(), - data_cells.size(), - data_cells.data() - ); + const auto data_cells_result = archetype.to_data_cells(); + if (data_cells_result.is_ok()) { + return try_log_data_row( + entity_path, + archetype.num_instances(), + data_cells_result.value.size(), + data_cells_result.value.data() + ); + } else { + return data_cells_result.error; + } } /// Logs a list of component arrays. @@ -180,7 +181,10 @@ namespace rerun { std::vector data_cells; data_cells.reserve(sizeof...(Ts)); - push_data_cells(data_cells, component_array...); + const auto error = push_data_cells(data_cells, component_array...); + if (error.is_err()) { + return error; + } return try_log_data_row( entity_path, @@ -216,36 +220,44 @@ namespace rerun { } template - static void push_data_cells( + static Error push_data_cells( std::vector& data_cells, const std::vector& first, const Ts&... rest ) { - // TODO(andreas): Error handling. - const auto cell = C::to_data_cell(first.data(), first.size()).ValueOrDie(); - data_cells.push_back(cell); - push_data_cells(data_cells, rest...); + const auto cell_result = C::to_data_cell(first.data(), first.size()); + if (cell_result.is_err()) { + return cell_result.error; + } + data_cells.push_back(cell_result.value); + return push_data_cells(data_cells, rest...); } template - static void push_data_cells( + static Error push_data_cells( std::vector& data_cells, const std::array& first, const Ts&... rest ) { - // TODO(andreas): Error handling. - const auto cell = C::to_data_cell(first.data(), N).ValueOrDie(); - data_cells.push_back(cell); - push_data_cells(data_cells, rest...); + const auto cell_result = C::to_data_cell(first.data(), N); + if (!cell_result.is_ok()) { + return cell_result.error; + } + data_cells.push_back(cell_result.value); + return push_data_cells(data_cells, rest...); } template - static void push_data_cells( + static Error push_data_cells( std::vector& data_cells, const C (&first)[N], const Ts&... rest ) { - // TODO(andreas): Error handling. - const auto cell = C::to_data_cell(first, N).ValueOrDie(); - data_cells.push_back(cell); - push_data_cells(data_cells, rest...); + const auto cell_result = C::to_data_cell(first, N); + if (!cell_result.is_ok()) { + return cell_result.error; + } + data_cells.push_back(cell_result.value); + return push_data_cells(data_cells, rest...); } - static void push_data_cells(std::vector&) {} + static Error push_data_cells(std::vector&) { + return Error(); + } RecordingStream(uint32_t id, StoreKind store_kind) : _id(id), _store_kind(store_kind) {} diff --git a/rerun_cpp/src/rerun/result.hpp b/rerun_cpp/src/rerun/result.hpp new file mode 100644 index 000000000000..18b7ccb295b2 --- /dev/null +++ b/rerun_cpp/src/rerun/result.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include +#include + +#include "error.hpp" + +namespace rerun { + /// A class for representing either a usable value, or an error. + /// + /// In essence a simplified version of rust's Result or arrow's arrow::Result, always using + /// rerun::Status. For simplicity, the wrapped type must be default constructible. + template + class [[nodiscard]] Result { + static_assert( + std::is_default_constructible::value, + "Result can only wrap default constructible types." + ); + + public: + /// Don't allow uninitialized results. + Result() = delete; + + /// Construct a result from a value, setting error to ok. + Result(T _value) : value(std::move(_value)), error() {} + + /// Construct a result from an error, default constructing the value. + Result(rerun::Error _error) : value(), error(std::move(_error)) {} + + /// Construct a result from an arrow status, default constructing the value. + Result(const arrow::Status& status) : value(), error(status) {} + + /// Construct a result from an arrow status, default constructing the value. + Result(arrow::Status&& status) : value(), error(std::move(status)) {} + + /// Returns true if error is set to rerun::ErrorCode::Ok, implying that a value is + /// contained, false otherwise. + bool is_ok() const { + return error.is_ok(); + } + + /// Returns true if error is not set to rerun::ErrorCode::Ok, implying that no value is + /// contained, false otherwise. + bool is_err() const { + return error.is_err(); + } + +#ifdef __cpp_exceptions + /// Returns the value if status is ok, throws otherwise. + T value_or_throw() const { + error.throw_on_failure(); + return value; + } +#endif + + public: + T value; + rerun::Error error; + }; +} // namespace rerun diff --git a/rerun_cpp/tests/archetypes/archetype_test.hpp b/rerun_cpp/tests/archetypes/archetype_test.hpp index 90c9bbe97f29..a975a1742ad7 100644 --- a/rerun_cpp/tests/archetypes/archetype_test.hpp +++ b/rerun_cpp/tests/archetypes/archetype_test.hpp @@ -5,21 +5,20 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wsign-conversion" #include -#include #pragma GCC diagnostic pop template void test_serialization_for_manual_and_builder(const T& from_manual, const T& from_builder) { THEN("serialization succeeds") { auto from_builder_serialized = from_builder.to_data_cells(); - REQUIRE(from_builder_serialized.ok()); + REQUIRE(from_builder_serialized.is_ok()); auto from_manual_serialized = from_manual.to_data_cells(); - REQUIRE(from_manual_serialized.ok()); + REQUIRE(from_manual_serialized.is_ok()); AND_THEN("the serialized data is the same") { - auto from_builder_cells = from_builder_serialized.ValueOrDie(); - auto from_manual_cells = from_manual_serialized.ValueOrDie(); + auto from_builder_cells = from_builder_serialized.value; + auto from_manual_cells = from_manual_serialized.value; CHECK(from_builder_cells.size() == from_manual_cells.size()); for (size_t i = 0; i < from_builder_cells.size(); ++i) { diff --git a/rerun_cpp/tests/archetypes/disconnected_space.cpp b/rerun_cpp/tests/archetypes/disconnected_space.cpp index 7f2e0a5128c2..93002cb6735f 100644 --- a/rerun_cpp/tests/archetypes/disconnected_space.cpp +++ b/rerun_cpp/tests/archetypes/disconnected_space.cpp @@ -11,7 +11,7 @@ SCENARIO("disconnected_space archetype can be serialized" TEST_TAG) { auto from_builder = DisconnectedSpace(true); THEN("serialization succeeds") { - CHECK(from_builder.to_data_cells().ok()); + CHECK(from_builder.to_data_cells().is_ok()); } } } diff --git a/rerun_cpp/tests/error_check.hpp b/rerun_cpp/tests/error_check.hpp index 85bf6149f04b..779cf55e4bc1 100644 --- a/rerun_cpp/tests/error_check.hpp +++ b/rerun_cpp/tests/error_check.hpp @@ -4,7 +4,7 @@ /// Checks if the given operation logs the expected status code. template -auto check_logged_status( +auto check_logged_error( Op operation, rerun::ErrorCode expected_status_code = rerun::ErrorCode::Ok ) { static rerun::Error last_logged_status; diff --git a/rerun_cpp/tests/recording_stream.cpp b/rerun_cpp/tests/recording_stream.cpp index 72bf40a1e37c..86be9a9cea35 100644 --- a/rerun_cpp/tests/recording_stream.cpp +++ b/rerun_cpp/tests/recording_stream.cpp @@ -23,6 +23,30 @@ namespace rrc = rr::components; #define TEST_TAG "[recording_stream]" +struct BadComponent { + static const char* NAME; + static rr::Error error; + + static rr::Result to_data_cell(const BadComponent*, size_t) { + return error; + } +}; + +const char* BadComponent::NAME = "bad!"; +rr::Error BadComponent::error = rr::Error(rr::ErrorCode::Unknown, "BadComponent"); + +struct BadArchetype { + rr::Error error = rr::Error(rr::ErrorCode::Unknown, "BadArchetype"); + + size_t num_instances() const { + return 1; + } + + rr::Result> to_data_cells() const { + return error; + } +}; + namespace rerun { std::ostream& operator<<(std::ostream& os, StoreKind kind) { switch (kind) { @@ -47,7 +71,7 @@ SCENARIO("RecordingStream can be created, destroyed and lists correct properties AND_GIVEN("a valid application id") { THEN("creating a new stream does not log an error") { rr::RecordingStream stream = - check_logged_status([&] { return rr::RecordingStream("test", kind); }); + check_logged_error([&] { return rr::RecordingStream("test", kind); }); AND_THEN("it does not crash on destruction") {} @@ -59,7 +83,7 @@ SCENARIO("RecordingStream can be created, destroyed and lists correct properties AND_GIVEN("a nullptr for the application id") { THEN("creating a new stream logs a null argument error") { - check_logged_status( + check_logged_error( [&] { rr::RecordingStream stream(nullptr, kind); }, rr::ErrorCode::UnexpectedNullArgument ); @@ -67,7 +91,7 @@ SCENARIO("RecordingStream can be created, destroyed and lists correct properties } AND_GIVEN("invalid utf8 character sequence for the application id") { THEN("creating a new stream logs an invalid string argument error") { - check_logged_status( + check_logged_error( [&] { rr::RecordingStream stream("\xc3\x28", kind); }, rr::ErrorCode::InvalidStringArgument ); @@ -220,7 +244,7 @@ SCENARIO("RecordingStream can log to file", TEST_TAG) { REQUIRE(stream1->save(test_rrd1.c_str()).is_ok()); WHEN("logging a component to the second stream") { - check_logged_status([&] { + check_logged_error([&] { stream1->log_components( "as-array", std::array{ @@ -237,7 +261,7 @@ SCENARIO("RecordingStream can log to file", TEST_TAG) { } } WHEN("logging an archetype to the second stream") { - check_logged_status([&] { + check_logged_error([&] { stream1->log_archetype( "archetype", rr::archetypes::Points2D({ @@ -279,7 +303,7 @@ void test_logging_to_connection(const char* address, rr::RecordingStream& stream REQUIRE(stream.connect(address, 0.0f).is_ok()); WHEN("logging a component and then flushing") { - check_logged_status([&] { + check_logged_error([&] { stream.log_components( "as-array", std::array{ @@ -295,7 +319,7 @@ void test_logging_to_connection(const char* address, rr::RecordingStream& stream } } WHEN("logging an archetype and then flushing") { - check_logged_status([&] { + check_logged_error([&] { stream.log_archetype( "archetype", rr::archetypes::Points2D({ @@ -359,7 +383,7 @@ SCENARIO("Recording stream handles invalid logging gracefully", TEST_TAG) { CHECK(stream.try_log_archetype(path, rr::archetypes::Points2D(v)).code == error); } THEN("log_components logs the correct error") { - check_logged_status( + check_logged_error( [&] { stream.log_components(std::get<0>(variant), std::array{v}); }, @@ -367,7 +391,7 @@ SCENARIO("Recording stream handles invalid logging gracefully", TEST_TAG) { ); } THEN("log_archetypes logs the correct error") { - check_logged_status( + check_logged_error( [&] { stream.log_archetype(std::get<0>(variant), rr::archetypes::Points2D(v)); }, @@ -378,6 +402,7 @@ SCENARIO("Recording stream handles invalid logging gracefully", TEST_TAG) { AND_GIVEN("a valid path") { const char* path = "valid"; + AND_GIVEN("a cell with a null buffer") { rr::DataCell cell; cell.buffer = nullptr; @@ -423,3 +448,70 @@ SCENARIO("Recording stream handles invalid logging gracefully", TEST_TAG) { } } } + +SCENARIO("Recording stream handles serialization failure during logging gracefully", TEST_TAG) { + GIVEN("a new RecordingStream and a valid entity path") { + rr::RecordingStream stream("test"); + const char* path = "valid"; + AND_GIVEN("an component that fails serialization") { + const auto component = BadComponent(); + BadComponent::error.code = + GENERATE(rr::ErrorCode::Unknown, rr::ErrorCode::ArrowStatusCode_TypeError); + + THEN("calling log_components with an array logs the serialization error") { + check_logged_error( + [&] { + stream.log_components(path, std::array{component, component}); + }, + component.error.code + ); + } + THEN("calling log_components with a vector logs the serialization error") { + check_logged_error( + [&] { + stream.log_components(path, std::vector{component, component}); + }, + component.error.code + ); + } + THEN("calling log_components with a c array logs the serialization error") { + const BadComponent components[] = {component, component}; + check_logged_error( + [&] { stream.log_components(path, components); }, + component.error.code + ); + } + THEN("calling try_log_components with an array forwards the serialization error") { + CHECK( + stream.try_log_components(path, std::array{component, component}) == + component.error + ); + } + THEN("calling try_log_components with a vector forwards the serialization error") { + CHECK( + stream.try_log_components(path, std::vector{component, component}) == + component.error + ); + } + THEN("calling try_log_components with a c array forwards the serialization error") { + const BadComponent components[] = {component, component}; + CHECK(stream.try_log_components(path, components) == component.error); + } + } + AND_GIVEN("an archetype that fails serialization") { + auto archetype = BadArchetype(); + archetype.error.code = + GENERATE(rr::ErrorCode::Unknown, rr::ErrorCode::ArrowStatusCode_TypeError); + + THEN("calling log_archetype logs the serialization error") { + check_logged_error( + [&] { stream.log_archetype(path, archetype); }, + archetype.error.code + ); + } + THEN("calling log_archetype forwards the serialization error") { + CHECK(stream.try_log_archetype(path, archetype) == archetype.error); + } + } + } +}