psArguments.h

Go to the documentation of this file.
00001 /** @file  psArguments.h
00002  *
00003  *  @brief Contains operations for parsing command line input arguments.
00004  *
00005  *  @author David Robbins, MHPCC
00006  *
00007  *  @version $Revision: 1.4 $ $Name:  $
00008  *  @date $Date: 2007/01/23 22:47:23 $
00009  *
00010  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00011  */
00012 
00013 #ifndef PS_ARGUMENTS_H
00014 #define PS_ARGUMENTS_H
00015 
00016 /// @addtogroup SysUtils
00017 /// @{
00018 
00019 #include "psMetadata.h"
00020 
00021 /** Implements the various verbosity controls.
00022  *
00023  *  Arguments shall be removed from the argument list as they are processed.
00024  *
00025  *  @return int:        The resultant logging level.
00026  */
00027 int psArgumentVerbosity(
00028     int *argc,                         ///< number of arguments
00029     char **argv                        ///< the argument list
00030 );
00031 
00032 /** Checks for an argument and returns its index position if found.
00033  *
00034  *  @return int:        The index of the element in the argument list, otherwise 0.
00035  */
00036 int psArgumentGet(
00037     int argc,                          ///< number of arguments
00038     char **argv,                       ///< the argument list
00039     const char *arg                    ///< the specified argument to match
00040 );
00041 
00042 /** Removes from the argument list the argument whose index is argnum.
00043  *
00044  *  The number of entries in the argument list shall be decremented.
00045  *
00046  *  @return bool:       True if the argnum is in the argument list, otherwise false.
00047  */
00048 bool psArgumentRemove(
00049     int argnum,                        ///< the argument to remove
00050     int *argc,                         ///< number of arguments
00051     char **argv                        ///< the argument list
00052 );
00053 
00054 /** Parses the command line arguments into a metadata container of arguments.
00055  *
00056  *  The input arguments shall contain the list of possible arguments as the keywords providing
00057  *  the default values.  As matching arguments are found on the command line, the values shall
00058  *  be read into the arguments metadata, with the appropriate type.  The arguments and their
00059  *  values shall be removed from the list of command line arguments as they are processed.
00060  *
00061  *  @return bool:       False if any argument was encountered that is not present in arguments.
00062  */
00063 bool psArgumentParse(
00064     psMetadata *arguments,             ///< metadata container for arguments
00065     int *argc,                         ///< number of arguments
00066     char **argv                        ///< the argument list
00067 );
00068 
00069 /** Prints to stdout a guide to the command-line arguments.      */
00070 void psArgumentHelp(
00071     psMetadata *arguments              ///< metadata container for arguments
00072 );
00073 
00074 /// @}
00075 #endif // #ifndef PS_ARGUMENTS_H

Generated on Fri Feb 2 22:24:35 2007 for pslib by  doxygen 1.5.1