! . */
| 7537 | |
| 7538 | /*! . */ |
| 7539 | GMT_LOCAL void *gmtapi_import_data (struct GMTAPI_CTRL *API, enum GMT_enum_family family, int object_ID, unsigned int mode, void *data) { |
| 7540 | |
| 7541 | /* Function that will import the data object referred to by the object_ID (or all registered inputs if object_ID == GMT_NOTSET). |
| 7542 | * This is a wrapper functions for CPT, Dataset, Grid, Image and PostScript imports; see the specific functions |
| 7543 | * for details on the arguments, in particular the mode setting (or see the GMT API documentation). |
| 7544 | */ |
| 7545 | int item, flag = GMT_NOTSET; |
| 7546 | void *new_obj = NULL; |
| 7547 | |
| 7548 | if (API == NULL) return_null (API, GMT_NOT_A_SESSION); /* GMT_Create_Session has not been called */ |
| 7549 | if (!API->registered[GMT_IN]) return_null (API, GMT_NO_INPUT); /* No sources registered yet */ |
| 7550 | |
| 7551 | /* Get information about this resource first */ |
| 7552 | if (multiple_files_ok (family)) { |
| 7553 | flag = (API->module_input) ? GMTAPI_MODULE_INPUT : GMTAPI_OPTION_INPUT; |
| 7554 | } |
| 7555 | if ((item = gmtlib_validate_id (API, family, object_ID, GMT_IN, flag)) == GMT_NOTSET) return_null (API, API->error); |
| 7556 | |
| 7557 | switch (family) { |
| 7558 | case GMT_IS_PALETTE: |
| 7559 | new_obj = gmtapi_import_palette (API, object_ID, mode); /* Try to import a CPT */ |
| 7560 | break; |
| 7561 | case GMT_IS_DATASET: |
| 7562 | new_obj = gmtapi_import_dataset (API, object_ID, mode); /* Try to import data tables */ |
| 7563 | break; |
| 7564 | case GMT_IS_GRID: |
| 7565 | new_obj = gmtapi_import_grid (API, object_ID, mode, data); /* Try to import a grid */ |
| 7566 | break; |
| 7567 | case GMT_IS_IMAGE: |
| 7568 | new_obj = gmtapi_import_image (API, object_ID, mode, data); /* Try to import an image */ |
| 7569 | break; |
| 7570 | case GMT_IS_CUBE: |
| 7571 | new_obj = gmtapi_import_cube (API, object_ID, mode, data); /* Try to import a 3-D cube */ |
| 7572 | break; |
| 7573 | case GMT_IS_MATRIX: |
| 7574 | new_obj = gmtapi_import_matrix (API, object_ID, mode); /* Try to import a matrix */ |
| 7575 | break; |
| 7576 | case GMT_IS_VECTOR: |
| 7577 | new_obj = gmtapi_import_vector (API, object_ID, mode); /* Try to import a vector */ |
| 7578 | break; |
| 7579 | case GMT_IS_POSTSCRIPT: |
| 7580 | new_obj = gmtapi_import_postscript (API, object_ID, mode); /* Try to import PS */ |
| 7581 | break; |
| 7582 | default: |
| 7583 | API->error = GMT_NOT_A_VALID_FAMILY; |
| 7584 | break; |
| 7585 | } |
| 7586 | if (new_obj == NULL) return_null (API, API->error); /* Return NULL as something went wrong */ |
| 7587 | return (new_obj); /* Successful, return pointer */ |
| 7588 | } |
| 7589 | |
| 7590 | /*! . */ |
| 7591 | GMT_LOCAL void *gmtapi_get_data (void *V_API, int object_ID, unsigned int mode, void *data) { |
no test coverage detected