Configuration System


Data Structures

struct  pmConfig
 Configuration information. More...

Enumerations

enum  pmRecipeSource { PM_RECIPE_SOURCE_NONE = 0x00, PM_RECIPE_SOURCE_SITE = 0x01, PM_RECIPE_SOURCE_CAMERA = 0x02, PM_RECIPE_SOURCE_CL = 0x04, PM_RECIPE_SOURCE_SYMBOLIC = 0x14, PM_RECIPE_SOURCE_ALL = 0xff }
 Sources for recipes. More...

Functions

pmConfigpmConfigAlloc (int *argc, char **argv)
 Allocator for pmConfig.
void pmConfigSet (const char *path)
 Set static configuration information.
void pmConfigDone (void)
 Free static memory used in the configuration system.
pmConfigpmConfigRead (int *argc, char **argv, char *defaultRecipe)
 Read configuration information from the command line.
bool pmConfigFileRead (psMetadata **config, const char *name, const char *description)
 Read a configuration file.
bool pmConfigValidateCameraFormat (bool *valid, const psMetadata *cameraFormat, const psMetadata *header)
 Validate a header against the camera format.
psMetadata * pmConfigCameraFormatFromHeader (pmConfig *config, const psMetadata *header)
 Determine the camera format (and camera if unknown) from examining the header.
psMetadata * pmConfigCameraByName (pmConfig *config, const char *cameraName)
 Return the camera configuration specified by name.
psDB * pmConfigDB (pmConfig *config)
 Setup the database.
bool pmConfigConformHeader (psMetadata *header, const psMetadata *format)
 Make the supplied header conform to the nominated camera format.
psArray * pmConfigFileSets (pmConfig *config, const char *file, const char *list)
 Read the command-line for files (or a text file containing a list of files).
bool pmConfigFileSetsMD (psMetadata *metadata, pmConfig *config, const char *name, const char *file, const char *list)
 Stuff associated files from the command-line into a metadata.
psString pmConfigConvertFilename (const char *filename, const pmConfig *config, bool create)
 Convert the supplied name, create a new output psString.
bool pmConfigReadParamsSet (bool newReadCameraConfig)
 Set whether all config parameters are read on startup.
bool pmConfigCameraMosaickedVersions (psMetadata *site, const char *name)
 Generate the chip mosaicked version of a particular camera configuration.
bool pmConfigCameraMosaickedVersionsAll (psMetadata *site)
 Generate chip- and fpa-mosaicked versions of all the camera configurations.
bool pmConfigReadRecipes (pmConfig *config, pmRecipeSource source)
 Read recipes.
bool pmConfigLoadRecipeArguments (pmConfig *config)
bool pmConfigLoadRecipeOptions (pmConfig *config, char *flag)
psMetadata * pmConfigRecipeOptions (pmConfig *config, char *recipe)
psString psModulesVersion (void)
 Get current psModules version.
psString psModulesVersionLong (void)
 Get current psModules version (full identification).


Enumeration Type Documentation

enum pmRecipeSource

Sources for recipes.

Defines what recipe sources have been read. This allows us to read recipes from different sources as they become available. For example, we may not have access to the camera configuration until we have read a FITS file. We allow symbolic links, which means the user can specify on the command-line the name of a recipe that's defined elsewhere, instead of typing the entire filename. This structure is private to psModules --- there is no need for the user to know about it.

Enumerator:
PM_RECIPE_SOURCE_NONE  None yet.
PM_RECIPE_SOURCE_SITE  Site configuration.
PM_RECIPE_SOURCE_CAMERA  Camera configuration.
PM_RECIPE_SOURCE_CL  Command-line.
PM_RECIPE_SOURCE_SYMBOLIC  Symbolic link, specified on command-line.
PM_RECIPE_SOURCE_ALL  All sources.

Definition at line 25 of file pmConfig.h.


Function Documentation

pmConfig* pmConfigAlloc ( int *  argc,
char **  argv 
)

Allocator for pmConfig.

Parameters:
argv  Number of command-line arguments Command-line arguments

psMetadata* pmConfigCameraByName ( pmConfig config,
const char *  cameraName 
)

Return the camera configuration specified by name.

Given a camera name, returns the camera configuration metadata.

Parameters:
config  The configuration
cameraName  The camera name header

psMetadata* pmConfigCameraFormatFromHeader ( pmConfig config,
const psMetadata *  header 
)

Determine the camera format (and camera if unknown) from examining the header.

Given a FITS header, check it against all known cameras (unless we already know which camera, from pmConfigRead) and all known formats for those cameras in order to identify which is appropriate. The first matching format is accepted; further matches produce warnings. The accepted camera is saved in the configuration. The accepted format is returned.

Parameters:
config  The configuration
header  The FITS header

bool pmConfigCameraMosaickedVersions ( psMetadata *  site,
const char *  name 
)

Generate the chip mosaicked version of a particular camera configuration.

bool pmConfigCameraMosaickedVersionsAll ( psMetadata *  site  ) 

Generate chip- and fpa-mosaicked versions of all the camera configurations.

bool pmConfigConformHeader ( psMetadata *  header,
const psMetadata *  format 
)

Make the supplied header conform to the nominated camera format.

Given a FITS header, make it conform to the RULE in the specified camera format. This is useful for switching between formats, or generating fake data that must be recognised by pmConfigCameraFormatFromHeader.

Parameters:
header  Header to conform
format  Camera format

psString pmConfigConvertFilename ( const char *  filename,
const pmConfig config,
bool  create 
)

Convert the supplied name, create a new output psString.

Parameters:
filename  file path/URI
config  configuration
create  create the file if it doesn't exist

psDB* pmConfigDB ( pmConfig config  ) 

Setup the database.

Initialise the database connection using the DBSERVER, DBNAME, DBUSER, DBPASSWORD values provided in the site configuration. Stores the database handle in the configuration, and also returns it.

Parameters:
config  Configuration

void pmConfigDone ( void   ) 

Free static memory used in the configuration system.

bool pmConfigFileRead ( psMetadata **  config,
const char *  name,
const char *  description 
)

Read a configuration file.

Read a metadata configuration file into the supplied metadata. Produce an error and return false if there's a problem.

Parameters:
config  Config to output
name  Name of file
description  Description of file

psArray* pmConfigFileSets ( pmConfig config,
const char *  file,
const char *  list 
)

Read the command-line for files (or a text file containing a list of files).

Given the 'file' and 'list' arguments (e.g., "-file" and "-list"), find the arguments associated with these words and interpret them as lists of files. Return an array of the resulting filenames.

Parameters:
config  Configuration, containing command-line arguments
file  CL argument specifying a filename
list  CL argument specifying a text file with a list of filenames

bool pmConfigFileSetsMD ( psMetadata *  metadata,
pmConfig config,
const char *  name,
const char *  file,
const char *  list 
)

Stuff associated files from the command-line into a metadata.

Calls pmConfigFileSets to parse the command line for filenames (or a list which provides filenames), and stuffs the array of filenames into the metadata under "name".

Parameters:
metadata  Metadata into which to stuff the array
config  Configuration (which command-line arguments)
name  Name for array in the metadata
file  CL argument specifying a filename
list  CL argument specifying a text file with a list of filenames

bool pmConfigLoadRecipeArguments ( pmConfig config  ) 

bool pmConfigLoadRecipeOptions ( pmConfig config,
char *  flag 
)

pmConfig* pmConfigRead ( int *  argc,
char **  argv,
char *  defaultRecipe 
)

Read configuration information from the command line.

pmConfigRead loads the site configuration (the file name is specified by "-site SITE_FILE" on the command-line, the PS_SITE environment variable, or it is $HOME/.ipprc). The configuration search path is set. The camera configuration is loaded if it is specified on the command line ("-camera CAMERA_FILE"). Recipes specified on the command line ("-recipe RECIPE_NAME RECIPE_SOURCE") are also loaded. These command-line arguments are removed from from the command-line, to simplify parsing. The psLib log, trace and time setups are also performed if specified in the site configuration.

Parameters:
argc  Number of command-line arguments
argv  Array of command-line arguments
defaultRecipe  name of top-level recipe for this program

bool pmConfigReadParamsSet ( bool  newReadCameraConfig  ) 

Set whether all config parameters are read on startup.

bool pmConfigReadRecipes ( pmConfig config,
pmRecipeSource  source 
)

Read recipes.

Attempt to read recipes from the sources that are available but have not already been read. Having read a recipe, attempt to resolve symbolic links that were specified on the command line.

Parameters:
config  Configuration
source  desired sources for recipes

psMetadata* pmConfigRecipeOptions ( pmConfig config,
char *  recipe 
)

void pmConfigSet ( const char *  path  ) 

Set static configuration information.

The search path for the configuration files is a local static variable, set by this function.

Parameters:
path  Search paths for configuration files; colon-delimited directories

bool pmConfigValidateCameraFormat ( bool *  valid,
const psMetadata *  cameraFormat,
const psMetadata *  header 
)

Validate a header against the camera format.

Given a FITS header (the PHU header), check it against the RULE metadata contained within the camera format; return found = true if it matches. return false on serious errors

Parameters:
cameraFormat  Camera format containing the RULE

psString psModulesVersion ( void   ) 

Get current psModules version.

Returns the current psModules version name as a string.

Returns:
psString: String with version name.

psString psModulesVersionLong ( void   ) 

Get current psModules version (full identification).

Returns the current psModules version name and other information identifying the compilation.

Returns:
psString: String with identity.


Generated on Fri Feb 2 22:35:59 2007 for Pan-STARRS Module Library by  doxygen 1.5.1