3.6. USERD Message Routines (Info, Error, Log, Etc.)

Most of the USERD routines operate passively. They wait for the server to call them and then hand up data. However, there are five USERD routines that call upwards into the server to pass information messages designed for feedback to the user from the reader. These routines are active and can be called at any location in any portion of a user-defined reader.

At this point, these routines will print their output to the EnSight console. The names of the routines and when to call them are as follows.

USERD_info(const char format, ....)

Normal informational output typically to the console. It is a good idea to have a reader Format Option pulldown that is None, Normal, Verbose and Debug to control the amount of informational output that the user experiences.

USERD_warn(const char format, ....)

Encountered a problem but still proceeding with the read. This is either console or pop-up window.

USERD_error(const char format, ....)

Encountered a problem in which an error will be returned up to the server. This should be in a pop-up window in the future. This calls a sample routine named cvf_stop_here that you can use as a break location.

USERD_fatal(const char format, ....)

A message indicating a fatal error which should not be called unless a crash is imminent as it may result in the future in with a pop-up window and a graceful shutdown of EnSight. This calls a sample routine named cvf_stop_here that you can use as a break location.

USERD_log(const char format, ....)

All the output that you wish to go to a log, which should be the standard log file.

Example 3.1: Usage

USERD_info("Reading file number %d\n",fnum);

USERD_warn("Warning: missing element %d\n",elem_num);

USERD_error("Error, var value %12.5g exceeded %12.5g. Aborting\n",var_val,max_val);

Implementation

In your reader, after your include of global_extern.h, you must include global_extern_functions.h (in one C/C++ source file and one file only) in order to use these functions.

#include global_extern.h

#include global_extern_functions.h