MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / gmtapi_get_object

Function gmtapi_get_object

src/gmt_api.c:3095–3112  ·  view source on GitHub ↗

! . */

Source from the content-addressed store, hash-verified

3093
3094/*! . */
3095GMT_LOCAL int gmtapi_get_object (struct GMTAPI_CTRL *API, int sfamily, void *ptr) {
3096 /* Returns the ID of the first object whose resource pointer matches ptr.
3097 * Unless family is GMT_NOTSET the object must be of the specified family.
3098 */
3099 unsigned int item;
3100 enum GMT_enum_family family;
3101 int object_ID = GMT_NOTSET; /* Not found yet */
3102 struct GMTAPI_DATA_OBJECT *S_obj = NULL;
3103
3104 if (sfamily != GMT_NOTSET) family = sfamily;
3105 for (item = 0; object_ID == GMT_NOTSET && item < API->n_objects; item++) { /* Loop over all objects */
3106 if ((S_obj = API->object[item]) == NULL) continue; /* Skip freed objects */
3107 if (S_obj->resource == NULL) continue; /* No resource pointer */
3108 if (sfamily != GMT_NOTSET && S_obj->family != family) continue; /* Not the right family */
3109 if (S_obj->resource == ptr && object_ID == GMT_NOTSET) object_ID = S_obj->ID; /* Found a matching data pointer */
3110 }
3111 return (object_ID); /* Return ID or GMT_NOTSET if not found */
3112}
3113
3114/*! . */
3115GMT_LOCAL void * gmtapi_pass_object (struct GMTAPI_CTRL *API, struct GMTAPI_DATA_OBJECT *object, unsigned int family, unsigned int mode, double *wesn) {

Callers 3

gmtapi_import_gridFunction · 0.85
gmtapi_import_cubeFunction · 0.85
GMT_Write_DataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected