! . */
| 8314 | |
| 8315 | /*! . */ |
| 8316 | unsigned int gmtlib_count_objects (struct GMTAPI_CTRL *API, enum GMT_enum_family family, unsigned int geometry, unsigned int direction, int *first_ID) { |
| 8317 | /* Count how many data sets of the given family are currently registered and unused for the given direction (GMT_IN|GMT_OUT). |
| 8318 | * Also return the ID of the first unused data object for the given direction, geometry, and family (GMT_NOTSET if not found). |
| 8319 | */ |
| 8320 | unsigned int i, n; |
| 8321 | |
| 8322 | *first_ID = GMT_NOTSET; /* Not found yet */ |
| 8323 | for (i = n = 0; i < API->n_objects; i++) { |
| 8324 | if (!API->object[i]) continue; /* A freed object, skip it */ |
| 8325 | if (API->object[i]->direction != (enum GMT_enum_std)direction) continue; /* Wrong direction */ |
| 8326 | if (API->object[i]->geometry != (enum GMT_enum_geometry)geometry) continue; /* Wrong geometry */ |
| 8327 | if (API->object[i]->status != GMT_IS_UNUSED) continue; /* Already used */ |
| 8328 | if (family != API->object[i]->family) continue; /* Wrong data type */ |
| 8329 | n++; /* Found one that satisfied requirements */ |
| 8330 | if (*first_ID == GMT_NOTSET) *first_ID = API->object[i]->ID; |
| 8331 | } |
| 8332 | return (n); |
| 8333 | } |
| 8334 | |
| 8335 | /*! . */ |
| 8336 | char * gmtlib_create_header_item (struct GMTAPI_CTRL *API, unsigned int mode, void *arg) { |
no outgoing calls
no test coverage detected