cxDataCheck - check datatype at the current level of detail
#include <cx/DataOps.h>

typedef enum { cx_data_dead, cx_mem_size, cx_mem_bounds, cx_data_ok } cxDataCheckError;

typedef struct { cxDataCheckError error; void *ptr; char *msg;
} cxDataCheckErrorInfo;
cxDataCheckErrorInfo *cxDataCheck( void *data, const char *description )
integer cx_data_dead
integer cx_mem_size
integer cx_mem_bounds
integer cx_data_ok

parameter (cx_data_dead = 0) parameter (cx_mem_size = 1) parameter (cx_mem_bounds = 2) parameter (cx_data_ok = 3)
integer function cxDataCheck(data, description) integer data integer description
Data to be checked.
Character string describing where the check is being performed.
cxDataCheck checks the integrity of the data pointed to by data, at the cxDataCheckLevel specified by cxDataCheckingSet. If an error condition is detected, the current cxDataCheckAction routine is called, and an cxDataCheckErrorInfo structure is created and returned. It is the programmer's responsibility to destroy the returned structure using cxDataCheckErrorInfoDel.

The error field of the returned structure enumerates the actual error detected. The ptr field points to the actual offending memory. The msg field contains a message that helps trace the exact location of the error. For example, the following code:

  cxDataCheckErrorInfo *err;
  cxLattice *lat = cxLatNew( ... );
  lat->nDim = -1;   /* should be > 0 */
  err = cxDataCheckSet( lat, "constructed the lattice" );
would return an error structure in which error is cx_ndim_range, ptr is the address of lat->nDim, and the trace message is something like this:
  Number of cxLattice dimensions <= 0,
    in cxLattice @ 0x806dfc
    constructed the lattice
The trace message and ptr field are especially valuable when an error occurs in nested IRIS Explorer types, e.g. the nDim in the cxCoord in the cxLattice in the second layer of a cxPyramid.

If no error is detected, a NULL is returned.

cxDataCheckingSet(3E), cxDataMagicCheck(3E), cxDataMemBoundsCheck(3E), cxDataCheckErrorInfoDel(3E), cxDataCheckErrorInfoGet(3E)
Last modified: Mon Nov 6 16:33:02 GMT 2000
[ Documentation Home ]
© The Numerical Algorithms Group Ltd, Oxford UK. 1996