| 185 | } |
| 186 | |
| 187 | void Array::validate(libmexclass::proxy::method::Context& context) { |
| 188 | namespace mda = ::matlab::data; |
| 189 | mda::StructArray args = context.inputs[0]; |
| 190 | const mda::TypedArray<std::uint8_t> validation_mode_mda = args[0]["ValidationMode"]; |
| 191 | const auto validation_mode_integer = uint8_t(validation_mode_mda[0]); |
| 192 | // Convert integer representation to ValidationMode enum. |
| 193 | const auto validation_mode = static_cast<ValidationMode>(validation_mode_integer); |
| 194 | switch (validation_mode) { |
| 195 | case ValidationMode::None: { |
| 196 | // Do nothing. |
| 197 | break; |
| 198 | } |
| 199 | case ValidationMode::Minimal: { |
| 200 | MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(array->Validate(), context, |
| 201 | error::ARRAY_VALIDATE_MINIMAL_FAILED); |
| 202 | break; |
| 203 | } |
| 204 | case ValidationMode::Full: { |
| 205 | MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(array->ValidateFull(), context, |
| 206 | error::ARRAY_VALIDATE_FULL_FAILED); |
| 207 | break; |
| 208 | } |
| 209 | default: { |
| 210 | // Throw an error if an unsupported enumeration value is provided. |
| 211 | const auto msg = "Unsupported ValidationMode enumeration value: " + |
| 212 | std::to_string(validation_mode_integer); |
| 213 | context.error = |
| 214 | libmexclass::error::Error{error::ARRAY_VALIDATE_UNSUPPORTED_ENUM, msg}; |
| 215 | return; |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | } // namespace arrow::matlab::array::proxy |
nothing calls this directly
no test coverage detected