Functions for data descriptor management


Functions

int read_tables (char *dir, int vmtab, int vltab, int subcent, int gencent)
 Reads bufr tables from csv-files.
void show_desc (int f, int x, int y)
 Prints the specified descriptor or all if f = 999.
int get_index (int typ, dd *descr)
 Returns the index for the given descriptor and typ.
int read_tab_d (char *fname)
 Reads bufr table d from a csv-files.
int read_tab_b (char *fname)
 Reads bufr table b from a csv-files.
void free_descs (void)
 Frees all memory that has been allocated for data descriptors.
char * get_unit (dd *d)
 Returns the unit for a given data descriptor.

Function Documentation

int read_tables ( char *  dir,
int  vmtab,
int  vltab,
int  subcent,
int  gencent 
)

This function reads the descriptor tables from csv-files and stores the descriptors in a global array des. Memory for the descriptors is allocated by this function and has to be freed using free_descs.
The filenames are generated by this function and have the form bufrtab{b|d}_Y.csv or loctab{b|d}_X_Y.csv where X is a value calculated of the originating center and subcenter. (X = subcent * 256 + gencent) Y is the table version.

Parameters:
[in] dir The directory where to search for tables, if NULL the function uses the current directory
[in] vmtab Master table version number
[in] vltab Local table version number.
[in] subcent Originating/generating subcenter
[in] gencent Originating/generating center
Returns:
Returns 0 on success or -1 on errors.
Note:
The local tables are optional
Examples:
apisample.c.

Definition at line 155 of file desc.c.

void show_desc ( int  f,
int  x,
int  y 
)

This function prints all information on the specified descriptor or all descriptors if f = 999

Parameters:
[in] f,x,y The descriptor to display.

Definition at line 210 of file desc.c.

int get_index ( int  typ,
dd descr 
)

This function returns the index into the global des array of a descriptor given by parameters typ and descr.

Parameters:
[in] typ The type of descriptor (ELDESC or SEQDESC).
[in] descr The descriptor.
Returns:
The index of the descriptor in des or -1 on error.

Definition at line 337 of file desc.c.

int read_tab_d ( char *  fname  ) 

This function reads a sequence descriptor table (d) from a csv-file and stores the descriptors in a global array des. Memory for the descriptors is allocated by this function and has to be freed using free_descs.

Parameters:
[in] fname The name of a csv-file.
Returns:
Returns 1 on success or 0 on error.
See also:
read_tables, read_tab_b

Definition at line 387 of file desc.c.

int read_tab_b ( char *  fname  ) 

This function reads an element descriptor table (b) from a csv-file and stores the descriptors in a global array des. Memory for the descriptors is allocated by this function and has to be freed using free_descs.

Parameters:
[in] fname The name of the csv-file.
Returns:
Returns 1 on success or 0 on error.
See also:
read_tables, read_tab_d

Definition at line 548 of file desc.c.

void free_descs ( void   ) 

This function frees all memory that has been allocated for data descriptors

See also:
read_tables, read_tab_b, read_tab_d
Examples:
apisample.c.

Definition at line 678 of file desc.c.

char* get_unit ( dd d  ) 

This function searches the global des array and returns the unit for a data descriptor.

Parameters:
[in] d The descriptor.
Returns:
Pointer to a string containing the unit or NULL if the descriptor is not found in the global des array.

Definition at line 904 of file desc.c.


Generated on Tue Dec 18 16:52:45 2007 for OPERA BUFR software by  doxygen 1.5.4