Public Member Functions | Private Member Functions | Private Attributes | Friends

chomp::homology::arguments Class Reference

The objects of this class gather the expected command-line arguments and decode them. More...

#include <arg.h>

List of all members.

Public Member Functions

 arguments ()
 The default constructor.
 ~arguments ()
 The destructor.
void add (argelement *p)
 Adds an argument to the end of the list.
int remove (char *name)
 Removes all the arguments with this name from the list and return the number of removed items.
int analyze (int argc, char *argv[], std::ostream &out=std::cerr)
 Analyzes the arguments from the command line strings.
void reset ()
 Resets the flags and returns previous argument values (except for tables).

Private Member Functions

void inctable ()
 Increases the tables if necessary.

Private Attributes

int n
 The number of arguments in the table.
int length
 The allocated length of the table of arguments.
argelement ** tab
 The table of pointers to specific arguments.

Friends

std::ostream & operator<< (std::ostream &out, arguments &p)
 Displays the arguments actually decoded (for debugging purpose).

Detailed Description

The objects of this class gather the expected command-line arguments and decode them.

It is recommended that you use the various functions called "arg" to enqueue the arguments into the list of arguments. When the list is complete, one just calls the "analyze" method of the class. Detailed instructions are gathered in the "arg.txt" file. The program "argtest.cpp" and most CHomP programs very well illustrate how to use various features of this class.

Definition at line 534 of file arg.h.


Constructor & Destructor Documentation

chomp::homology::arguments::arguments (  )  [inline]

The default constructor.

Definition at line 582 of file arg.h.

References length, n, and tab.

{
        n = 0;
        length = 0;
        tab = NULL;
        return;
} /* arguments::arguments */

chomp::homology::arguments::~arguments (  ) 

The destructor.


Member Function Documentation

void chomp::homology::arguments::add ( argelement p  )  [inline]

Adds an argument to the end of the list.

Definition at line 590 of file arg.h.

References inctable(), n, and tab.

{
        inctable ();
        tab [n ++] = p;
        return;
} /* arguments::add */

int chomp::homology::arguments::analyze ( int  argc,
char *  argv[],
std::ostream &  out = std::cerr 
)

Analyzes the arguments from the command line strings.

Returns a negative value in case of error (the negation of the number of errors) and displays error messages to the given output stream. Returns 1 if it is requested to stop the program (and show help information, for instance). Returns 0 otherwise.

void chomp::homology::arguments::inctable (  )  [private]

Increases the tables if necessary.

Referenced by add().

int chomp::homology::arguments::remove ( char *  name  ) 

Removes all the arguments with this name from the list and return the number of removed items.

void chomp::homology::arguments::reset (  ) 

Resets the flags and returns previous argument values (except for tables).


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
arguments p 
) [friend]

Displays the arguments actually decoded (for debugging purpose).


Member Data Documentation

The allocated length of the table of arguments.

Definition at line 572 of file arg.h.

Referenced by arguments().

The number of arguments in the table.

Definition at line 569 of file arg.h.

Referenced by add(), and arguments().

The table of pointers to specific arguments.

Definition at line 575 of file arg.h.

Referenced by add(), and arguments().


The documentation for this class was generated from the following file: