MpatRestore()函数

Synopsis

Restore a pattern matching model from disk.

Format

MIL_ID MpatRestore(SystemId, FileName, ModelIdPtr)

MIL_ID SystemId; System identifier
char *FileName; Model file name
MIL_ID *ModelIdPtr; Storage location for model identifier

Description

This function restores a previously saved model from disk and returns a handle to it. If the model was preprocessed before saving, you do not need to preprocess it again.

This function also restores all the model search parameters that were in effect when the model was saved.

The SystemId parameter specifies the system on which the model buffer will be restored. This parameter must be set to a valid system identifier, M_DEFAULT_HOST or M_DEFAULT. To use the default Host system of the current MIL application, specify M_DEFAULT_HOST. If you specify M_DEFAULT, MIL will select the most appropriate system on which to allocate the buffer (the Host system or any already allocated system).

The FileName parameter specifies the model file name. The function handles (internally) the opening and closing of the file.

The ModelIdPtr parameter specifies the address of the variable in which the model buffer identifier is to be written. Since the MpatRestore function also returns the model buffer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Example

For example, you can restore a previously saved model that you found to be satisfactory for your application. In this example, we assume that you have saved it in model.mmo with MpatSave.

MpatRestore(SystemId, “model.mmo”, &ModelId);

Returned value

The returned value is the model buffer identifier. If allocation fails, M_NULL is returned.

See also

MpatSave, MpatRead, MpatWrite

《MpatRestore()函数》上有3条评论

评论已关闭。