NCEPLIBS-bufr  12.2.0
All Data Structures Namespaces Files Functions Variables Macros Pages
stseq.c File Reference

Store information about a Table D descriptor within internal DX BUFR tables. More...

#include "bufrlib.h"
#include "mstabs.h"
#include "rpseqs.h"

Go to the source code of this file.

Functions

int cmpia (const void *pf1, const void *pf2)
 Define a comparison between two integers. More...
 
void nummtb (int *idn, char *tab, int *ipt)
 Search for an entry in the BUFR master table. More...
 
int srchrpsq (int maxnf, int naf, int *iafpk, int maxcd, int ncdesc, int *cdesc)
 Check whether a replication sequence already exists within the internal cache. More...
 
void strrpsq (int rpidn, int maxnf, int naf, int *iafpk, int maxcd, int ncdesc, int *cdesc)
 Store a new entry in the internal replication sequences cache. More...
 
void stseq (int lun, int *irepct, int idn, char *nemo, char *cseq, int *cdesc, int ncdesc)
 Store information about a Table D descriptor within internal DX BUFR tables. More...
 

Detailed Description

Store information about a Table D descriptor within internal DX BUFR tables.

Author
J. Ator
Date
2009-03-23

Definition in file stseq.c.

Function Documentation

◆ cmpia()

int cmpia ( const void *  pf1,
const void *  pf2 
)

Define a comparison between two integers.

This routine defines a comparison between two integers for use by the binary search function bsearch.

Parameters
pf1- First integer to be compared
pf2- Second integer to be compared
Returns
  • -1 = pf1 is less than pf2
  • 0 = pf1 is equal to pf2
  • 1 = pf1 is greater than pf2
Author
J. Ator
Date
2009-03-23

Definition at line 28 of file stseq.c.

Referenced by nummtb().

◆ nummtb()

void nummtb ( int *  idn,
char *  tab,
int *  ipt 
)

Search for an entry in the BUFR master table.

This routine searches for an entry corresponding to idn in the bufr master table (either 'B' or 'D', depending on the value of idn). The search uses binary search logic, so all of the entries in the table must be sorted in ascending order (by FXY number) in order for this routine to work properly.

Parameters
idn- WMO bit-wise representation of FXY number to be searched for
tab- Table in which idn was found ('B' or 'D')
ipt- Index of entry for idn in master table tab
Author
J. Ator
Date
2009-03-23

Definition at line 54 of file stseq.c.

References bort_f(), cadn30_f(), cmpia(), FXY_MINTD, FXY_STR_LEN, ibfxyn_c, idfxyn_c, ifxy_f(), nmtb_c, and nmtd_c.

Referenced by stseq().

◆ srchrpsq()

int srchrpsq ( int  maxnf,
int  naf,
int *  iafpk,
int  maxcd,
int  ncdesc,
int *  cdesc 
)

Check whether a replication sequence already exists within the internal cache.

Given a replication sequence, this function searches the internal cache to see if that sequence already exists in the cache, and if so returns the WMO bit-wise representation of the corresponding FXY number.

Parameters
maxnf- Maximum number of associated fields in any replication sequence
naf- Number of associated fields in replication sequence
iafpk- Associated fields in replication sequence
maxcd- Maximum number of child descriptors in any replication sequence
ncdesc- Number of child descriptors in replication sequence
cdesc- Child descriptors in replication sequence
Returns
- WMO bit-wise representation of FXY number for replication sequence, if found in the internal cache
  • -1 = The replication sequence was not found in the internal cache
Author
J. Ator
Date
2024-08-26

Definition at line 137 of file stseq.c.

References cdescs, iafpk, iafpks, icvidx(), nafs, ncdescs, nrpsq, and rpidns.

Referenced by stseq().

◆ strrpsq()

void strrpsq ( int  rpidn,
int  maxnf,
int  naf,
int *  iafpk,
int  maxcd,
int  ncdesc,
int *  cdesc 
)

Store a new entry in the internal replication sequences cache.

Parameters
rpidn- WMO bit-wise representation of FXY number for replication sequence
maxnf- Maximum number of associated fields in any replication sequence
naf- Number of associated fields in replication sequence
iafpk- Associated fields in replication sequence
maxcd- Maximum number of child descriptors in any replication sequence
ncdesc- Number of child descriptors in replication sequence
cdesc- Child descriptors in replication sequence
Author
J. Ator
Date
2024-08-26

Definition at line 98 of file stseq.c.

References cdescs, iafpk, iafpks, icvidx(), MAX_RPSQ, nafs, ncdescs, nrpsq, and rpidns.

Referenced by stseq().

◆ stseq()

void stseq ( int  lun,
int *  irepct,
int  idn,
char *  nemo,
char *  cseq,
int *  cdesc,
int  ncdesc 
)

Store information about a Table D descriptor within internal DX BUFR tables.

Given the WMO bit-wise (integer) representation of a Table D descriptor, this function uses the master BUFR tables to store all of the necessary information for that descriptor within the internal DX BUFR tables. Any child descriptors which are themselves Table D descriptors are automatically resolved via a recursive call to this same function.

Parameters
lun- File ID
irepct- Replication sequence counter for the current master table; used internally to keep track of which sequence names have already been defined, and thereby avoid contention within the internal DX BUFR Table D
idn- WMO bit-wise representation of FXY value for Table D descriptor
nemo- Mnemonic corresponding to idn
cseq- Description corresponding to idn
cdesc- Array of child descriptors equivalent to idn
ncdesc- Number of child descriptors in cdesc
Author
J. Ator
Date
2009-03-23

Definition at line 189 of file stseq.c.

References bort_f(), cadn30_f(), cbbw_c, cbelem_c, cbmnem_c, cbscl_c, cbsref_c, cbunit_c, cdmnem_c, cdseq_c, elemdx_f(), FXY_DRF1, FXY_DRF16, FXY_DRF8, FXY_DRP1, FXY_DRP16, FXY_DRP8, FXY_MAXTB, FXY_MINR, FXY_MINTD, FXY_STR_LEN, iafpk, icvidx(), idefxy_c, ifxy_f(), igetntbi_f(), igetprm_f(), igettdi_f(), imrkopr_f(), ndelem_c, NEMO_STR_LEN, nemtab_f(), nrpsq, nummtb(), numtbd_f(), pktdd_f(), srchrpsq(), stntbi_f(), strnum_f(), and strrpsq().