Difference between revisions of "Parameters.h"

From Genome Analysis Wiki
Jump to navigationJump to search
(Created page with '''Parameters.h'' is a header file that defines a series of classes that are useful for processing command line parameters. == Example Usage == <source lang="cpp"> #include "…')
 
 
Line 9: Line 9:
 
  int main(int argc, char ** argv)
 
  int main(int argc, char ** argv)
 
     {
 
     {
 +
    int anInteger = 0, anotherInteger = 1;
 +
    double aDouble = 0.4321;
 +
 
     ParameterList pl;
 
     ParameterList pl;
  
     pl.Add(new IntParameter('n', "A number", aNumber));
+
     pl.Add(new IntParameter('i', "Favorite Integer", anInteger));
 +
    pl.Add(new IntParameter('2', "Another Integer", anotherInteger));
 +
    pl.Add(new DoubleParameter('2', "Floating point value", aDouble));
 
     pl.Read(argc, argv);
 
     pl.Read(argc, argv);
 
     pl.Status();
 
     pl.Status();

Latest revision as of 03:26, 26 November 2009

Parameters.h is a header file that defines a series of classes that are useful for processing command line parameters.

Example Usage

 #include "Parameters.h"

 int main(int argc, char ** argv)
    {
    int anInteger = 0, anotherInteger = 1;
    double aDouble = 0.4321;

    ParameterList pl;

    pl.Add(new IntParameter('i', "Favorite Integer", anInteger));
    pl.Add(new IntParameter('2', "Another Integer", anotherInteger));
    pl.Add(new DoubleParameter('2', "Floating point value", aDouble));
    pl.Read(argc, argv);
    pl.Status();
    }

Key Classes Declared

  • ParameterList is the key class and is the class you will most often use in your own code
  • IntParameter is a class for retrieving integers
  • SwitchParameter is a class for retrieving on/off switches
  • DoubleParameter is a class for retrieving double precision integers
  • StringParameter is a class for manipulating strings
  • LongParameter is a class for handling long option names

Dependencies

Depends on StringMap.h