DIPlib Documentation - ©1995-2008 Quantitative Imaging Group, Delft University of Technology.

ovl.h

Call an overloaded function

SYNOPSIS

dip_DataType ovlDataType = [current data type];
[#define DIP_OVL_ASSIGN [assignment target]]
#define DIP_OVL_FUNC  [function base name]
#define DIP_OVL_ARGS  [argument list]
#define DIP_OVL_ALLOW [type identifiers]
#include "dip_ovl.h"

FUNCTION

Call a type specific function based on the data type stored in the ovlDataType variable. The base name of the function is passed to dip_ovl.h by defining DIP_OVL_FUNC. The argument list is passed by defining DIP_OVL_ARGS. By defining DIP_OVL_ALLOW the list of data types for which overloading is possible can be controlled. If DIP_OVL_ALLOW is not defined, all data types are allowed. The list is specified by a logical OR of identifier and identifier group flags, see the table at DIPlib's data types. The code executed by dip_ovl.h is the following:

/* if ovlDataType is in the list specified by DIP_OVL_ALLOW */
DIPXJ( DIP_FUNC(DIP_OVL_FUNC,ovlDataType's extension) DIP_OVL_ARGS );
/* if ovlDataType is not in the list specified by DIP_OVL_ALLOW */
DIPSJ( DIP_E_DATA_TYPE_NOT_SUPPORTED );

DIP_FUNC is described in macros.h. Note that there are no brackets around DIP_OVL_ARGS, so they must be included in DIP_OVL_ARGS itself. If ovlDataType is one of the binary types, DIP_OVL_BINARY_ARGS can be defined to override DIP_OVL_ARGS.

If DIP_OVL_ASSIGN is defined, the following code will be executed by dip_ovl.h instead of the code shown above:

DIP_OVL_ASSIGN DIP_FUNC(DIP_OVL_FUNC,ovlDataType's extension) DIP_OVL_ARGS;

Note that to actually perform an assignment the "=" operator must be included in the definition of DIP_OVL_ASSIGN itself. DIP_OVL_BINARY_ASSIGN overrides DIP_OVL_ASSIGN if ovlDataType is one of the binary data types.

SEE ALSO

DIPlib's data types

DataTypeGetInfo, tpi.h

DIPlib on-line documentation | Function reference | Global function index