GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> CDM / V0-2-6 > cdm / mv2304


Interface   Data Structures   File List   Data Fields   Globals  

CDM_utility.c File Reference

Collection of functions to support CDM database management. More...

#include <stdio.h>
#include <string.h>
#include <CDM/CDM_msgs.h>
#include <CDM/CDM_pubdefs.h>
#include <PBI/PTR.h>
#include <CDM_prvdefs.h>

Functions

unsigned int CDM_countInstance (unsigned short schema)
 Count instances of a CDM database with a given schema.
CMX_asBuiltIdentity * CDM_findCAB (CDM_Database *cdb)
 Return the link to the CMX as built identity block.
CDM_DatabaseCDM_findDatabase (unsigned short schema, unsigned short instance)
 Find a CDM database by schema and instance.
const void * CDM_getData (CDM_Database *cdb)
 Return a pointer to the data block of a CDM database instance.
short CDM_getInstance (CDM_Database *cdb)
 Return the instance number of a CDM database instance.
unsigned int CDM_getKey (CDM_Database *cdb)
 Return the file key of a CDM database instance.
short CDM_getSchema (CDM_Database *cdb)
 Return the schema number of a CDM database instance.
short CDM_getVersion (CDM_Database *cdb)
 Return the version of a CDM database instance.
void CDM_insertDatabase (CDM_Database *cdm)
 Insert a CDM database into the database list.
void CDM_removeDatabase (CDM_Database *old)
 Remove a CDM database from the database list.
unsigned int CDM_scanDatabase (CDM_cb_ScanDatabase *rtn, void *prm)
 Scan though the database instance list.

Variables

struct _CDM_DatabaseCDM_root = NULL
 Head of database (singly-linked) list.


Detailed Description

Collection of functions to support CDM database management.

CVS $Id: CDM_utility.c,v 1.6 2011/03/24 22:25:28 apw Exp $

Function Documentation

unsigned int CDM_countInstance ( unsigned short  schema  ) 

Count instances of a CDM database with a given schema.

Parameters:
schema (in) Database schema
Return values:
x Number of instances
Count the number of database instances with the given schema.

References _CDM_Database::next, and _CDM_Database::schema.

CMX_asBuiltIdentity * CDM_findCAB ( CDM_Database cdb  ) 

Return the link to the CMX as built identity block.

Parameters:
cdb (in) CDM database handle
Return values:
x CMX as built identity block pointer
0 Cannot find the CMX as built identity block

References _CDM_Database::cab, and _CDM_Database::name.

Referenced by CDM_getKey(), CDM_loadDatabase(), and CDM_unloadDatabase().

CDM_Database * CDM_findDatabase ( unsigned short  schema,
unsigned short  instance 
)

Find a CDM database by schema and instance.

Parameters:
schema (in) Database schema
instance (in) Database instance number
Return values:
x Handle for database
NULL Database not found
Find a CDM database by schema and instance.

References _CDM_Database::instance, _CDM_Database::next, and _CDM_Database::schema.

Referenced by CDM_insertDatabase().

const void * CDM_getData ( CDM_Database cdb  ) 

Return a pointer to the data block of a CDM database instance.

Parameters:
cdb (in) CDM database handle
Return values:
x Pointer to database data block
NULL Invalid database handle

References _CDM_Database::check, and _CDM_Database::data.

short CDM_getInstance ( CDM_Database cdb  ) 

Return the instance number of a CDM database instance.

Parameters:
cdb (in) CDM database handle
Return values:
x Instance number
CDM_K_NONE Invalid database handle

References _CDM_Database::check, and _CDM_Database::instance.

unsigned int CDM_getKey ( CDM_Database cdb  ) 

Return the file key of a CDM database instance.

Parameters:
cdb (in) CDM database handle
Return values:
x File key
0 File key not found

References _CDM_Database::cab, CDM_findCAB(), and _CDM_Database::check.

short CDM_getSchema ( CDM_Database cdb  ) 

Return the schema number of a CDM database instance.

Parameters:
cdb (in) CDM database handle
Return values:
x Database schema number
CDM_K_NONE Invalid database handle

References _CDM_Database::check, and _CDM_Database::schema.

short CDM_getVersion ( CDM_Database cdb  ) 

Return the version of a CDM database instance.

Parameters:
cdb (in) CDM database handle
Return values:
x Database version
CDM_K_NONE Invalid database handle

References _CDM_Database::check, and _CDM_Database::version.

void CDM_insertDatabase ( CDM_Database cdm  ) 

Insert a CDM database into the database list.

Parameters:
cdm (in) CDM database handle
Insert a CDM database instance into the database list.

References CDM_findDatabase(), CDM_unloadDatabase(), _CDM_Database::check, _CDM_Database::instance, _CDM_Database::next, and _CDM_Database::schema.

void CDM_removeDatabase ( CDM_Database old  ) 

Remove a CDM database from the database list.

Parameters:
old (in) CDM database handle
Remove a CDM database instance from the database list.

References _CDM_Database::cab, _CDM_Database::check, and _CDM_Database::next.

unsigned int CDM_scanDatabase ( CDM_cb_ScanDatabase rtn,
void *  prm 
)

Scan though the database instance list.

Parameters:
rtn (in) Scan callback routine
prm (in) Scan callback routine parameter
Return values:
x Return code from last scan call made.
CDM_scanDatabase() scans through the CDM database instance list, calling the provided callback routine for each member. The scan is aborted if the callback routine returns a failure code (least significant bit set).

References _CDM_Database::next.


Generated on Wed Nov 21 17:56:09 2012 by  doxygen 1.5.8