| 25 | : Type(std::move(struct_type)) {} |
| 26 | |
| 27 | libmexclass::proxy::MakeResult StructType::make( |
| 28 | const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
| 29 | namespace mda = ::matlab::data; |
| 30 | using StructTypeProxy = arrow::matlab::type::proxy::StructType; |
| 31 | |
| 32 | mda::StructArray args = constructor_arguments[0]; |
| 33 | const mda::TypedArray<uint64_t> field_proxy_ids_mda = args[0]["FieldProxyIDs"]; |
| 34 | |
| 35 | std::vector<std::shared_ptr<arrow::Field>> fields; |
| 36 | fields.reserve(field_proxy_ids_mda.getNumberOfElements()); |
| 37 | for (const auto proxy_id : field_proxy_ids_mda) { |
| 38 | using namespace libmexclass::proxy; |
| 39 | auto proxy = std::static_pointer_cast<proxy::Field>(ProxyManager::getProxy(proxy_id)); |
| 40 | auto field = proxy->unwrap(); |
| 41 | fields.push_back(field); |
| 42 | } |
| 43 | |
| 44 | auto struct_type = std::static_pointer_cast<arrow::StructType>(arrow::struct_(fields)); |
| 45 | return std::make_shared<StructTypeProxy>(std::move(struct_type)); |
| 46 | } |
| 47 | } // namespace arrow::matlab::type::proxy |