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

Function gmtapi_retrieve_data

src/gmt_api.c:1848–1880  ·  view source on GitHub ↗

! . */

Source from the content-addressed store, hash-verified

1846
1847/*! . */
1848GMT_LOCAL void * gmtapi_retrieve_data (void *V_API, int object_ID) {
1849 /* Function to return pointer to the container for a registered data set.
1850 * Typically used when we wish a module to "write" its results to a memory
1851 * location that we wish to access from the calling program. The procedure
1852 * is to use GMT_Register_IO with GMT_REF|COPY|READONLY and GMT_OUT but use
1853 * NULL as the source/destination. Data are "written" by GMT allocating a
1854 * output container and updating the objects->resource pointer to this container.
1855 * gmtapi_retrieve_data simply returns that pointer given the registered ID.
1856 */
1857
1858 int item;
1859 struct GMTAPI_CTRL *API = NULL;
1860 struct GMTAPI_DATA_OBJECT *S_obj = NULL;
1861
1862 if (V_API == NULL) return_null (V_API, GMT_NOT_A_SESSION);
1863
1864 /* Determine the item in the object list that matches this object_ID */
1865 API = gmtapi_get_api_ptr (V_API);
1866 API->error = GMT_NOERROR;
1867 if ((item = gmtlib_validate_id (API, GMT_NOTSET, object_ID, GMT_NOTSET, GMT_NOTSET)) == GMT_NOTSET) {
1868 return_null (API, API->error);
1869 }
1870 S_obj = API->object[item]; /* Short hand */
1871 /* Make sure the resource is present */
1872 if (S_obj->resource == NULL) {
1873 return_null (API, GMT_PTR_IS_NULL);
1874 }
1875
1876#ifdef DEBUG
1877 //gmtapi_list_objects (API, "gmtapi_retrieve_data");
1878#endif
1879 return (S_obj->resource); /* Return pointer to the resource container */
1880}
1881
1882/*! . */
1883GMT_LOCAL int gmtapi_begin_io (struct GMTAPI_CTRL *API, unsigned int direction) {

Callers 1

GMT_Read_VirtualFileFunction · 0.85

Calls 2

gmtapi_get_api_ptrFunction · 0.85
gmtlib_validate_idFunction · 0.85

Tested by

no test coverage detected