| 4511 | |
| 4512 | template <typename T> |
| 4513 | void matlab_struct::sub::get(T& item) const |
| 4514 | { |
| 4515 | if (struct_handle == 0) |
| 4516 | throw dlib::error("Attempt to access data in an empty struct."); |
| 4517 | |
| 4518 | mxArray* temp = mxGetFieldByNumber((const mxArray*)struct_handle, 0, field_idx); |
| 4519 | if (temp == 0) |
| 4520 | throw dlib::error("Attempt to access data in an empty struct."); |
| 4521 | |
| 4522 | try |
| 4523 | { |
| 4524 | mex_binding::validate_and_populate_arg(0,temp,item); |
| 4525 | } |
| 4526 | catch(mex_binding::invalid_args_exception& e) |
| 4527 | { |
| 4528 | std::ostringstream sout; |
| 4529 | sout << "Struct field '" << mxGetFieldNameByNumber((const mxArray*)struct_handle, field_idx) << "' can't be interpreted as the requested type." |
| 4530 | << endl << e.what(); |
| 4531 | throw dlib::error(sout.str()); |
| 4532 | } |
| 4533 | } |
| 4534 | |
| 4535 | const matlab_struct::sub matlab_struct:: |
| 4536 | operator[] (const std::string& name) const |
no test coverage detected