File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
matlab/src/cpp/arrow/matlab/proxy Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -189,4 +189,17 @@ namespace arrow::matlab::proxy {
189
189
WrapTypeFunctor functor;
190
190
return wrap (datatype, functor);
191
191
}
192
+
193
+ arrow::Result<::matlab::data::StructArray> wrap_and_manage (const std::shared_ptr<arrow::DataType>& datatype) {
194
+ namespace mda = ::matlab::data;
195
+ mda::ArrayFactory factory;
196
+
197
+ ARROW_ASSIGN_OR_RAISE (auto proxy, wrap (datatype));
198
+ const auto proxy_id = libmexclass::proxy::ProxyManager::manageProxy (proxy);
199
+
200
+ mda::StructArray output = factory.createStructArray ({1 , 1 }, {" ProxyID" , " TypeID" });
201
+ output[0 ][" ProxyID" ] = factory.createScalar (proxy_id);
202
+ output[0 ][" TypeID" ] = factory.createScalar ( static_cast <int32_t >(datatype->id ()));
203
+ return output;
204
+ }
192
205
}
Original file line number Diff line number Diff line change @@ -40,4 +40,8 @@ namespace arrow::matlab::proxy {
40
40
// / \return arrow::result<std::shared_ptr<arrow::matlab::type::proxy::Type>>
41
41
arrow::Result<std::shared_ptr<arrow::matlab::type::proxy::Type>> wrap (const std::shared_ptr<arrow::DataType>& datatype);
42
42
43
- }
43
+ // / \brief Wraps an DataType within a proxy::DataType and adds the proxy to the ProxyManager..
44
+ // /
45
+ // / \return arrow::Result<mda::StructArray>. The mda::StructArray has two fields: ProxyID (uint64) and TypeID (int32).
46
+ arrow::Result<std::shared_ptr<arrow::matlab::type::proxy::Type>> wrap (const std::shared_ptr<arrow::DataType>& datatype);
47
+ }
You can’t perform that action at this time.
0 commit comments