prg_tfile_name_list_get()
Abstract
Returns a list of model file names.
Syntax
prg_tfile_name_list_get (type)
| Argument | Type | Description |
|---|---|---|
type |
PrgT_Tfile_Type |
Model file type of interest. See Table 5 for a list of the constants used to specify a model type. |
Return Type
Prg_List*
Returns a pointer to the list containing the names of files corresponding to the requested type. These file names lack a file extension and represent the "visible" files as per the user's "mod_dirs" settings.
Header
prg_file_funcs.h
Example
/* Obtain a list of network models. */
file_list = prg_tfile_name_list_get (PrgC_Tfile_Type_Network);
printf ("Network files\n");
if (file_list) {
op_prg_list_map (file_list, prg_test_map_string_fast, 0);
}
/* Obtain a list of node models. */
file_list = prg_tfile_name_list_get (PrgC_Tfile_Type_Node);
printf ("Node files\n");
if (file_list) {
op_prg_list_map (file_list, prg_test_map_string_fast, 0);
}
/* Obtain a list of process models. */
file_list = prg_tfile_name_list_get (PrgC_Tfile_Type_Process);
printf ("Process files\n");
if (file_list) {
p_prg_list_map (file_list, prg_test_map_string_fast, 0);
}
Details
The available model files are constrained by the environment within which this function is executed. The "mod_dirs" preference specifies the list of model directories to be searched to obtain model names. The list of model files returned by this function should be deallocated by calls to prg_list_free() and prg_mem_free() when no longer needed.
The model names stored in the list are base names, without extensions such as .nt.m or .ex.o.
Purpose
Provides a mechanism by which the names of specified types of models can be obtained from the system. These names can be used in future calls to open and read model files, or display model names for further processing.
Errors
- None
Reference
- use
prg_list_access()to access elements from the list. - use
prg_list_free()to deallocate elements in the model name list - use
prg_mem_free()to deallocate a list that is no longer useful, after freeing its elements