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

Function gmtapi_next_data_object

src/gmt_api.c:2850–2869  ·  view source on GitHub ↗

! . */

Source from the content-addressed store, hash-verified

2848
2849/*! . */
2850GMT_LOCAL int gmtapi_next_data_object (struct GMTAPI_CTRL *API, enum GMT_enum_family family, enum GMT_enum_std direction) {
2851 /* Sets up current_item to be the next unused item of the required direction; or return EOF.
2852 * When EOF is returned, API->current_item[direction] holds the last object ID used. */
2853 bool found = false;
2854 int item = API->current_item[direction] + 1; /* Advance to next item, if it exists */
2855 struct GMTAPI_DATA_OBJECT *S_obj = NULL;
2856 while (item < (int)API->n_objects && !found) {
2857 S_obj = API->object[item]; /* Current object in list */
2858 if (S_obj && S_obj->selected && S_obj->status == GMT_IS_UNUSED && S_obj->direction == direction && S_obj->family == family)
2859 found = true; /* Got item that is selected and unused, has correct direction and family */
2860 else
2861 item++; /* No, keep looking */
2862 }
2863 if (found) { /* Update to use next item */
2864 API->current_item[direction] = item; /* The next item */
2865 return (gmtapi_next_io_source (API, direction)); /* Initialize the next source/destination */
2866 }
2867 else
2868 return (EOF); /* No more objects available for this direction; return EOF */
2869}
2870
2871/*! Hook object to end of linked list and assign unique id (> 0) which is returned */
2872GMT_LOCAL int gmtapi_add_data_object (struct GMTAPI_CTRL *API, struct GMTAPI_DATA_OBJECT *object) {

Callers 4

gmtapi_get_record_fp_subFunction · 0.85
gmtapi_get_record_matrixFunction · 0.85
gmtapi_get_record_vectorFunction · 0.85
GMT_Begin_IOFunction · 0.85

Calls 1

gmtapi_next_io_sourceFunction · 0.85

Tested by

no test coverage detected