|
18 | 18 | #include "arrow/array.h"
|
19 | 19 | #include "arrow/c/bridge.h"
|
20 | 20 |
|
21 |
| -#include "arrow/matlab/c/proxy/array_importer.h" |
22 | 21 | #include "arrow/matlab/array/proxy/wrap.h"
|
| 22 | +#include "arrow/matlab/c/proxy/array_importer.h" |
23 | 23 | #include "arrow/matlab/error/error.h"
|
24 | 24 |
|
25 | 25 | #include "libmexclass/proxy/ProxyManager.h"
|
26 | 26 |
|
27 | 27 | namespace arrow::matlab::c::proxy {
|
28 | 28 |
|
29 |
| - ArrayImporter::ArrayImporter() { |
30 |
| - REGISTER_METHOD(ArrayImporter, import); |
31 |
| - } |
| 29 | +ArrayImporter::ArrayImporter() { REGISTER_METHOD(ArrayImporter, import); } |
32 | 30 |
|
33 |
| - libmexclass::proxy::MakeResult ArrayImporter::make(const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
34 |
| - return std::make_shared<ArrayImporter>(); |
35 |
| - } |
| 31 | +libmexclass::proxy::MakeResult ArrayImporter::make( |
| 32 | + const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
| 33 | + return std::make_shared<ArrayImporter>(); |
| 34 | +} |
36 | 35 |
|
37 |
| - void ArrayImporter::import(libmexclass::proxy::method::Context& context) { |
38 |
| - namespace mda = ::matlab::data; |
39 |
| - using namespace libmexclass::proxy; |
| 36 | +void ArrayImporter::import(libmexclass::proxy::method::Context& context) { |
| 37 | + namespace mda = ::matlab::data; |
| 38 | + using namespace libmexclass::proxy; |
40 | 39 |
|
41 |
| - mda::StructArray args = context.inputs[0]; |
42 |
| - const mda::TypedArray<uint64_t> arrow_array_address_mda = args[0]["ArrowArrayAddress"]; |
43 |
| - const mda::TypedArray<uint64_t> arrow_schema_address_mda = args[0]["ArrowSchemaAddress"]; |
| 40 | + mda::StructArray args = context.inputs[0]; |
| 41 | + const mda::TypedArray<uint64_t> arrow_array_address_mda = args[0]["ArrowArrayAddress"]; |
| 42 | + const mda::TypedArray<uint64_t> arrow_schema_address_mda = |
| 43 | + args[0]["ArrowSchemaAddress"]; |
44 | 44 |
|
45 |
| - const auto arrow_array_address = uint64_t(arrow_array_address_mda[0]); |
46 |
| - const auto arrow_schema_address = uint64_t(arrow_schema_address_mda[0]); |
| 45 | + const auto arrow_array_address = uint64_t(arrow_array_address_mda[0]); |
| 46 | + const auto arrow_schema_address = uint64_t(arrow_schema_address_mda[0]); |
47 | 47 |
|
48 |
| - struct ArrowArray* arrow_array = reinterpret_cast<struct ArrowArray*>(arrow_array_address); |
49 |
| - struct ArrowSchema* arrow_schema = reinterpret_cast<struct ArrowSchema*>(arrow_schema_address); |
| 48 | + struct ArrowArray* arrow_array = |
| 49 | + reinterpret_cast<struct ArrowArray*>(arrow_array_address); |
| 50 | + struct ArrowSchema* arrow_schema = |
| 51 | + reinterpret_cast<struct ArrowSchema*>(arrow_schema_address); |
50 | 52 |
|
51 |
| - MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(std::shared_ptr<arrow::Array> array, |
52 |
| - arrow::ImportArray(arrow_array, arrow_schema), |
53 |
| - context, error::C_IMPORT_FAILED); |
| 53 | + MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(std::shared_ptr<arrow::Array> array, |
| 54 | + arrow::ImportArray(arrow_array, arrow_schema), |
| 55 | + context, error::C_IMPORT_FAILED); |
54 | 56 |
|
55 |
| - MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(auto array_proxy, |
56 |
| - arrow::matlab::array::proxy::wrap(array), context, |
57 |
| - error::UNKNOWN_PROXY_FOR_ARRAY_TYPE); |
| 57 | + MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(auto array_proxy, |
| 58 | + arrow::matlab::array::proxy::wrap(array), context, |
| 59 | + error::UNKNOWN_PROXY_FOR_ARRAY_TYPE); |
58 | 60 |
|
59 |
| - mda::ArrayFactory factory; |
60 |
| - const auto array_proxy_id = ProxyManager::manageProxy(array_proxy); |
61 |
| - const auto array_proxy_id_mda = factory.createScalar(array_proxy_id); |
62 |
| - const auto array_type_id_mda = factory.createScalar(static_cast<int32_t>(array->type_id())); |
| 61 | + mda::ArrayFactory factory; |
| 62 | + const auto array_proxy_id = ProxyManager::manageProxy(array_proxy); |
| 63 | + const auto array_proxy_id_mda = factory.createScalar(array_proxy_id); |
| 64 | + const auto array_type_id_mda = |
| 65 | + factory.createScalar(static_cast<int32_t>(array->type_id())); |
63 | 66 |
|
64 |
| - context.outputs[0] = array_proxy_id_mda; |
65 |
| - context.outputs[1] = array_type_id_mda; |
66 |
| - } |
| 67 | + context.outputs[0] = array_proxy_id_mda; |
| 68 | + context.outputs[1] = array_type_id_mda; |
| 69 | +} |
67 | 70 |
|
68 |
| -} // namespace arrow::matlab::c::proxy |
| 71 | +} // namespace arrow::matlab::c::proxy |
0 commit comments