oasys::Getopt Class Reference

#include <Getopt.h>

List of all members.


Detailed Description

Definition at line 29 of file Getopt.h.


Public Member Functions

 Getopt ()
 Constructor (does nothing).
 ~Getopt ()
 Destructor to clean up all the opts.
void addopt (Opt *opt)
 Register a new option binding.
int getopt (const char *progname, int argc, char *const argv[], const char *extra_usage="")
 Parse argv, processing all registered getopt.
void usage (const char *progname, const char *extra_usage="")
 Prints a nicely formatted usage string to stderr.

Protected Types

typedef std::vector
< Opt * > 
OptList

Protected Attributes

Optopts_ [256]
OptList allopts_

Member Typedef Documentation

typedef std::vector<Opt*> oasys::Getopt::OptList [protected]

Definition at line 68 of file Getopt.h.


Constructor & Destructor Documentation

oasys::Getopt::Getopt (  ) 

Constructor (does nothing).

Definition at line 33 of file Getopt.cc.

References opts_.

oasys::Getopt::~Getopt (  ) 

Destructor to clean up all the opts.

Definition at line 39 of file Getopt.cc.

References allopts_.


Member Function Documentation

void oasys::Getopt::addopt ( Opt opt  ) 

Register a new option binding.

Definition at line 49 of file Getopt.cc.

References allopts_, opts_, and oasys::Opt::shortopt_.

Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), and main().

int oasys::Getopt::getopt ( const char *  progname,
int  argc,
char *const   argv[],
const char *  extra_usage = "" 
)

Parse argv, processing all registered getopt.

Returns the index of the first non-option argument in argv

Parameters:
progname the name of the executable
argc count of command line args
argv command line arg values
extra_opts additional usage string

Definition at line 66 of file Getopt.cc.

References allopts_, oasys::Opt::longopt_, oasys::Opt::needval_, opts_, oasys::Opt::set(), oasys::Opt::setp_, oasys::Opt::shortopt_, and usage().

Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), and main().

void oasys::Getopt::usage ( const char *  progname,
const char *  extra_usage = "" 
)

Prints a nicely formatted usage string to stderr.

Parameters:
progname the name of the executable
extra_opts additional usage string

Definition at line 172 of file Getopt.cc.

References allopts_, oasys::Opt::desc_, oasys::Opt::longopt_, oasys::Opt::shortopt_, snprintf(), and oasys::Opt::valdesc_.

Referenced by dtntunnel::DTNTunnel::get_options(), dtn::DTND::get_options(), getopt(), and main().


Member Data Documentation

Opt* oasys::Getopt::opts_[256] [protected]

Definition at line 70 of file Getopt.h.

Referenced by addopt(), getopt(), and Getopt().

OptList oasys::Getopt::allopts_ [protected]

Definition at line 71 of file Getopt.h.

Referenced by addopt(), getopt(), usage(), and ~Getopt().


The documentation for this class was generated from the following files:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3