| 74 | |
| 75 | protected: |
| 76 | void toMATLAB(libmexclass::proxy::method::Context& context) { |
| 77 | using CType = typename arrow::TypeTraits<ArrowType>::CType; |
| 78 | using NumericArray = arrow::NumericArray<ArrowType>; |
| 79 | |
| 80 | const auto num_elements = static_cast<size_t>(array->length()); |
| 81 | const auto numeric_array = std::static_pointer_cast<NumericArray>(array); |
| 82 | const CType* const data_begin = numeric_array->raw_values(); |
| 83 | const CType* const data_end = data_begin + num_elements; |
| 84 | |
| 85 | ::matlab::data::ArrayFactory factory; |
| 86 | |
| 87 | // Constructs a TypedArray from the raw values. Makes a copy. |
| 88 | ::matlab::data::TypedArray<CType> result = |
| 89 | factory.createArray({num_elements, 1}, data_begin, data_end); |
| 90 | context.outputs[0] = result; |
| 91 | } |
| 92 | }; |
| 93 | } // namespace arrow::matlab::array::proxy |
nothing calls this directly
no test coverage detected