MappAllocDefault()函数

Synopsis

Allocate MIL application defaults.

Format

void MappAllocDefault(InitFlag, ApplicationIdPtr, SystemIdPtr, DisplayIdPtr, DigIdPtr, ImageBufIdPtr)

long InitFlag; Initialization flag
MIL_ID *ApplicationIdPtr; Storage location for application identifier
MIL_ID *SystemIdPtr; Storage location for system identifier
MIL_ID *DisplayIdPtr; Storage location for display identifier
MIL_ID *DigIdPtr; Storage location for digitizer identifier
MIL_ID *ImageBufIdPtr; Storage location for image buffer identifier

Description

This macro sets up the requested MIL and processing environments using the defaults specified in the milsetup.h file. It can allocate and initialize a MIL application, allocate the system to receive the MIL commands, allocate the digitizer and display, and allocate and clear a displayable image buffer on this target system, depending on what is requested.

The InitFlag parameter specifies the type of initialization setup to perform and is used principally to initialize the default system. This parameter can be set to one of the following:

M_COMPLETE Perform a complete initialization of the MIL environment: initialize MIL to its default state and download any system’s required resident software. At least one complete initialization is necessary after you power-up your system.
M_PARTIAL Initialize MIL to its default state, but do not download any system’s resident software.
M_SETUP Set InitFlag to one of the above, based on the default state requested when the installation utility was run (refer to the milsetup.h file to determine what these setup defaults are).

M_PARTIAL should only be selected if the required resident software has already been downloaded. This option is particularly useful when debugging since resident software generally needs to be downloaded once after power-up (or rebooting the system) and the downloading process can take a substantial amount of initialization time on certain systems.

The ApplicationIdPtr parameter specifies the address of the variable in which the application identifier is to be written. Upon execution of this function, the default application specified in the milsetup.h file is allocated and its identifier returned. Instead of using MappAllocDefault, you can use MappAlloc to allocate an application. Note, an application must be allocated in order to allocate any other object in MIL.

The SystemIdPtr parameter specifies the address of the variable in which the system identifier is to be written. Upon execution of this function, the default system specified in the milsetup.h file is allocated and its identifier returned. Instead of using MappAllocDefault, you can use MsysAllocto allocate a system. MappAlloc will also allocate a default Host system. Note, a system must be allocated in order to allocate any other objects on it (display, digitizer or data buffers).

The DisplayIdPtr parameter specifies the address of the variable in which the display identifier is to be written. If this parameter is set to M_NULL, a display is not allocated; otherwise, the default display specified in the milsetup.h file is allocated and its identifier returned.

The DigIdPtr parameter specifies the address of the variable in which the digitizer identifier is to be written. If this parameter is set to M_NULL, a digitizer is not allocated; otherwise, the default digitizer specified in the milsetup.h file is allocated and its identifier returned.

The ImageBufIdPtr parameter specifies the address of the variable in which the image buffer identifier is to be written. If this parameter is set to M_NULL, an image buffer is not allocated; otherwise, the default image buffer specified in the milsetup.h file is allocated and its identifier returned. It is then cleared and displayed on the system’s display screen.

The installation utility modifies the milsetup.h header file to create the appropriate macros and customize the default setup. If the installation utility is not executed, the default state supported will be undefined.

After installation, if you want to change the default state of MappAllocDefault, edit milsetup.h to suit your needs.

Note, if a digitizer is specified and the default camera type (M_DEF_DIGITIZER_FORMAT) in the milsetup.h file is a 3-band color (RGB) type, then a 3-band image buffer will be allocated by default; otherwise, a 1-band image buffer will be allocated.

Example

For example, a typical default setup for a Genesis board in its power-up state with one input device (RS-170 camera) and one default image buffer (full-screen size) on the display is:

MappAllocDefault(M_COMPLETE, &System, &Display, &Digitizer, &ImageBuffer);

If, for example, you don’t need to acquire data from the camera but want to perform the rest of the above setup, you would make the following call:

MappAllocDefault(M_COMPLETE, &System, &Display, M_NULL, &ImageBuffer);

Note, upon execution of this function, a default graphics context is automatically allocated. This default graphics context can be used in MIL graphic function calls by specifying M_DEFAULT wherever a graphic context identifier is required

See also

MappFreeDefault, MappAlloc, MsysAlloc, MdispAlloc, MdigAlloc, MbufAllocColor, MbufAlloc1d, MbufAlloc2d