Page 22 out of 26 total pages


QBIC Error Handling Routines


To use QBIC's error handling routines, call QbInitializeErrorStructure(), which is declared in quError.h, at the beginning of your program or before any QBIC calls.

When an error is detected (as indicated by a nonzero return code from a class method or when False is returned after invoking the IsOK() method), you can retrieve the error severity state by calling GetErrorMSGSeverity().

If the severity state is QERR_FATAL, the system is in a fatal error state and should exit gracefully. To determine the problem, call QbPrintErrorMessage(FILE *stream) to print the error message to the specified IO stream.

Because most errors happen during memory allocation, the QBIC API provides the following set of routines specifically designed for memory allocation. Use these methods if you want to write your own feature extraction routines.

The following methods are described in this chapter:

GetErrorMSGSeverity method

This method returns error severity information.

Syntax

QERR_SeverityType GetErrorMSGSeverity(void);

Parameters

Input

None

Output

A enumerated value of either QERR_NON_FATAL or QERR_FATAL.

QbCNew method

This method is similar to QbNew, except that it creates memory for a specified number of objects as (nobj * size).

Syntax

void *QbCNew(size_t nobj, size_t size, const char *err_msg, 
QERR_SeverityType Sev = QERR_FATAL) 

Parameters

Input

Output

None

QbDelete method

This method frees memory allocated by the QbNew and QbCNew methods.

Syntax

void QbDelete(void *p) 

Parameters

Input

p-Pointer to the memory block to be freed

Output

None

QbInitializeErrorStructure method

This method initializes the error handling routine.

Syntax

QbInitializeErrorStructure();

Parameters

Input

None

Output

None

QbNew method

This method allocates a block of memory. If it fails, it returns a NULL and fills the QBIC error message buffer with the message (pointed to by the string err_msg).

Syntax

void *QbNew(size_t size,  const char *err_msg , QERR_SeverityType Sev = 
QERR_FATAL)

Parameters

Input

Output

None

QbPrintErrorMessage method

This method prints the error message to the specified file descriptor.

Syntax

void QbPrintErrorMessage(FILE *stream)

Parameters

Input

Output

None




Page 22 out of 26 total pages


xzhu@almaden.ibm.com or tedl@almaden.ibm.com
Copyright © 1998, IBM Corporation. All rights reserved.