Commit c5fdc8e
### Rationale for this change
This is a follow up to #38357 (comment).
In the C++ code for the MATLAB interface, we frequently `wrap`/`unwrap` Arrow types, like `arrow::Array`, into/from a corresponding `libmexclass` `Proxy` objects. This currently takes several lines of code, leading to lots of code duplication and introduces room for subtle implementation errors.
It would be helpful to abstract away some of the steps involved in `Proxy` creation/management into a set of helper utilities that we can reuse in the C++ code for the MATLAB interface.
### What changes are included in this PR?
1. Added a new utility function that wraps a `std::shared_ptr<arrow::Array>` in a `std::shared_ptr<arrow::matlab::array::proxy::Array>`. Its function signature is
```c++
arrow::Result<std::shared_ptr<arrow::matlab::array::proxy::Array>> wrap(const std::shared_ptr<arrow::Array>& array);`
````
2. Added a new utility function that wraps a `std::shared_ptr<arrow::Array>` in a `std::shared_ptr<arrow::matlab::array::proxy::Array>` and adds the proxy to the `libmexclass::proxy::ProxyManager`. Its function signature is
```c++
arrow::Result<std::shared_ptr<arrow::matlab::array::proxy::Array>> wrap_and_manage(const std::shared_ptr<arrow::Array>& array);
```
3. Added a new utility function that wraps a `std::shared_ptr<arrow::DataType>` in a `std::shared_ptr<arrow::matlab::type::proxy::Type>`. Its function signature is
```c++
arrow::Result<std::shared_ptr<arrow::matlab::type::proxy::Type>> wrap(const std::shared_ptr<arrow::DataType>& type);
```
4. Added a new utility function that wraps a `std::shared_ptr<arrow::DataType>` in a `std::shared_ptr<arrow::matlab::type::proxy::DataType>` and adds the proxy to the `libmexclass::proxy::ProxyManager`. It's function signature is
```c++
arrow::Result<std::shared_ptr<arrow::matlab::type::proxy::Type>> wrap_and_manage(const std::shared_ptr<arrow::DataType>& type);
```
5. Deleted `arrow::matlab::array::proxy::wrap` and `arrow::matlab::type::proxy::wrap` functions.
### Are these changes tested?
Tested via the existing MATLAB test classes.
### Are there any user-facing changes?
No.
* GitHub Issue: #38369
Lead-authored-by: Sarah Gilmore <sgilmore@mathworks.com>
Co-authored-by: Sarah Gilmore <74676073+sgilmore10@users.noreply.github.com>
Co-authored-by: Kevin Gurney <kevin.p.gurney@gmail.com>
Signed-off-by: Sarah Gilmore <sgilmore@mathworks.com>
1 parent d97e7ab commit c5fdc8e
19 files changed
Lines changed: 330 additions & 437 deletions
File tree
- matlab
- src
- cpp/arrow/matlab
- array/proxy
- c/proxy
- proxy
- tabular/proxy
- type/proxy
- matlab/+arrow
- +c/+internal
- +tabular
- +type
- tools/cmake
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
| 25 | + | |
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
| |||
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
127 | 115 | | |
128 | 116 | | |
129 | 117 | | |
| |||
167 | 155 | | |
168 | 156 | | |
169 | 157 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
182 | 161 | | |
183 | 162 | | |
184 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
126 | 125 | | |
127 | 126 | | |
128 | 127 | | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
140 | 131 | | |
141 | 132 | | |
142 | 133 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
158 | 137 | | |
159 | 138 | | |
160 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
82 | | - | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | 85 | | |
96 | 86 | | |
97 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
114 | 113 | | |
115 | 114 | | |
116 | 115 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 116 | + | |
| 117 | + | |
120 | 118 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | 119 | | |
133 | 120 | | |
134 | 121 | | |
| |||
154 | 141 | | |
155 | 142 | | |
156 | 143 | | |
157 | | - | |
| 144 | + | |
| 145 | + | |
158 | 146 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | 147 | | |
171 | 148 | | |
172 | 149 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | | - | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | | - | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
52 | 49 | | |
53 | 50 | | |
54 | 51 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
67 | 55 | | |
68 | 56 | | |
69 | 57 | | |
0 commit comments