/****************************************************************************** File name: jemx_shared_general.c Version: see below Component: Developer: Peter Kretschmar, ISDC Peter.Kretschmar@obs.unige.ch Purpose: General utility functions for JEM-X data processing *****************************************************************************/ /* * Revision 0.1.0 2004/01/23 * First draft * */ #include "jemx_shared.h" /***************************************************************************** Function: JEMXarrayGet Description: Set up a linear array and fill it with the data of the named child in the given group. NOTE 1: The array buffer is allocated within this function and must be freed in the calling function after the data has been mapped to some other array. NOTE 2: Any reformatting of the array to multiple dimensions has to take place in the calling function. Inspired by a function of C.A. Oxborrow but leaving type conversions to DAL. Error codes: 0 == ISDC_OK ==> function executed with no errors < 0 (various) ==> ISDC system function error code, passed on Parameter arguments: name range I/O description group !=NULL input handle to instrument model group arrayName (string) input name of child to read dataType any input DAL data type of array when allocated numAxes >0 input number of axes expected dimAxes (array) input dimensions of the axes array (array) output generic linear array chatter 0 to 5 input verbosity control variable callingStatus any input error status on input *****************************************************************************/ int JEMXarrayGet(dal_element *group, char *arrayName, dal_dataType arrayType, int numAxes, long *dimAxes, dal_element **arrayPtr, void **array, int chatter, int callingStatus) { /* * Local variable definitions */ int status = ISDC_OK; /* local status flag */ dal_dataType arrayTypeFound = DAL_DT_UNKNOWN; long startRange[DAL_MAX_ARRAY_DIMENSION]; long dimFoundAxes[DAL_MAX_ARRAY_DIMENSION]; long totalDim=0, numPixels=0, bufferSize=0; int i=0; int numFoundAxes=0; /* exit function immediately if status is not OK on entry */ if(callingStatus != ISDC_OK) return(callingStatus); /* Sanity check on dimensions */ if (DAL_MAX_ARRAY_DIMENSION