| 37 | } |
| 38 | |
| 39 | libmexclass::proxy::MakeResult Schema::make( |
| 40 | const libmexclass::proxy::FunctionArguments& constructor_arguments) { |
| 41 | namespace mda = ::matlab::data; |
| 42 | using SchemaProxy = arrow::matlab::tabular::proxy::Schema; |
| 43 | |
| 44 | mda::StructArray args = constructor_arguments[0]; |
| 45 | const mda::TypedArray<uint64_t> field_proxy_ids_mda = args[0]["FieldProxyIDs"]; |
| 46 | |
| 47 | std::vector<std::shared_ptr<arrow::Field>> fields; |
| 48 | for (const auto proxy_id : field_proxy_ids_mda) { |
| 49 | using namespace libmexclass::proxy; |
| 50 | auto proxy = std::static_pointer_cast<arrow::matlab::type::proxy::Field>( |
| 51 | ProxyManager::getProxy(proxy_id)); |
| 52 | auto field = proxy->unwrap(); |
| 53 | fields.push_back(field); |
| 54 | } |
| 55 | auto schema = arrow::schema(fields); |
| 56 | return std::make_shared<SchemaProxy>(std::move(schema)); |
| 57 | } |
| 58 | |
| 59 | std::shared_ptr<arrow::Schema> Schema::unwrap() { return schema; } |
| 60 | |