! . */
| 9154 | |
| 9155 | /*! . */ |
| 9156 | GMT_LOCAL int gmtapi_get_id (void *V_API, unsigned int family, unsigned int direction, void *resource) { |
| 9157 | unsigned int i; |
| 9158 | int item; |
| 9159 | struct GMTAPI_DATA_OBJECT *S_obj = NULL; |
| 9160 | struct GMTAPI_CTRL *API = NULL; |
| 9161 | |
| 9162 | if (V_API == NULL) return_error (V_API, GMT_NOT_A_SESSION); /* GMT_Create_Session has not been called */ |
| 9163 | API = gmtapi_get_api_ptr (V_API); |
| 9164 | API->error = GMT_NOERROR; |
| 9165 | for (i = 0, item = GMT_NOTSET; item == GMT_NOTSET && i < API->n_objects; i++) { |
| 9166 | if ((S_obj = API->object[i]) == NULL) continue; /* Empty object */ |
| 9167 | if (!S_obj->resource) continue; /* Empty resource */ |
| 9168 | if (S_obj->family != (enum GMT_enum_family)family) { /* Not the required data type, but check for exceptions */ |
| 9169 | if (family == GMT_IS_DATASET && (S_obj->family == GMT_IS_MATRIX || S_obj->family == GMT_IS_VECTOR)) |
| 9170 | S_obj->family = GMT_IS_DATASET; /* Vectors or Matrix masquerading as dataset are valid. Change their family here. */ |
| 9171 | else |
| 9172 | continue; |
| 9173 | } |
| 9174 | if (S_obj->direction != (enum GMT_enum_std)direction) continue; /* Not the required direction */ |
| 9175 | if (S_obj->resource == resource) item = i; /* Pick the requested object regardless of direction */ |
| 9176 | } |
| 9177 | if (item == GMT_NOTSET) return_value (API, GMT_NOT_A_VALID_ID, GMT_NOTSET); /* No such resource found */ |
| 9178 | return (S_obj->ID); |
| 9179 | } |
| 9180 | |
| 9181 | GMT_LOCAL bool gmtapi_matrix_data_conforms_to_grid (struct GMT_MATRIX *M) { |
| 9182 | /* Check if a matrix data array matches the form of a GMT grid (row-oriented floats) */ |
no test coverage detected