| 32 | } |
| 33 | |
| 34 | void ArrayImporter::import(libmexclass::proxy::method::Context& context) { |
| 35 | namespace mda = ::matlab::data; |
| 36 | |
| 37 | mda::StructArray args = context.inputs[0]; |
| 38 | const mda::TypedArray<uint64_t> arrow_array_address_mda = args[0]["ArrowArrayAddress"]; |
| 39 | const mda::TypedArray<uint64_t> arrow_schema_address_mda = |
| 40 | args[0]["ArrowSchemaAddress"]; |
| 41 | |
| 42 | const auto arrow_array_address = uint64_t(arrow_array_address_mda[0]); |
| 43 | const auto arrow_schema_address = uint64_t(arrow_schema_address_mda[0]); |
| 44 | |
| 45 | auto arrow_array = reinterpret_cast<struct ArrowArray*>(arrow_array_address); |
| 46 | auto arrow_schema = reinterpret_cast<struct ArrowSchema*>(arrow_schema_address); |
| 47 | |
| 48 | MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(auto array, |
| 49 | arrow::ImportArray(arrow_array, arrow_schema), |
| 50 | context, error::C_IMPORT_FAILED); |
| 51 | |
| 52 | MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(context.outputs[0], |
| 53 | arrow::matlab::proxy::wrap_and_manage(array), |
| 54 | context, error::UNKNOWN_PROXY_FOR_ARRAY_TYPE); |
| 55 | } |
| 56 | |
| 57 | } // namespace arrow::matlab::c::proxy |