The Original CHomP Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
chomp::homology::arguments Class Reference

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

#include <arg.h>

Public Member Functions

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

Private Member Functions

void inctable ()
 Increases the tables if necessary. More...
 

Private Attributes

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

Friends

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

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 533 of file arg.h.

Constructor & Destructor Documentation

◆ arguments()

chomp::homology::arguments::arguments ( )
inline

The default constructor.

Definition at line 581 of file arg.h.

582{
583 n = 0;
584 length = 0;
585 tab = NULL;
586 return;
587} /* arguments::arguments */
int n
The number of arguments in the table.
Definition: arg.h:568
int length
The allocated length of the table of arguments.
Definition: arg.h:571
argelement ** tab
The table of pointers to specific arguments.
Definition: arg.h:574

References length, n, and tab.

◆ ~arguments()

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

The destructor.

Member Function Documentation

◆ add()

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

Adds an argument to the end of the list.

Definition at line 589 of file arg.h.

590{
591 inctable ();
592 tab [n ++] = p;
593 return;
594} /* arguments::add */
void inctable()
Increases the tables if necessary.

References inctable(), n, and tab.

◆ analyze()

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.

◆ inctable()

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

Increases the tables if necessary.

Referenced by add().

◆ remove()

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

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

◆ reset()

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

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

Friends And Related Function Documentation

◆ operator<<

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

Displays the arguments actually decoded (for debugging purpose).

Member Data Documentation

◆ length

int chomp::homology::arguments::length
private

The allocated length of the table of arguments.

Definition at line 571 of file arg.h.

Referenced by arguments().

◆ n

int chomp::homology::arguments::n
private

The number of arguments in the table.

Definition at line 568 of file arg.h.

Referenced by add(), and arguments().

◆ tab

argelement** chomp::homology::arguments::tab
private

The table of pointers to specific arguments.

Definition at line 574 of file arg.h.

Referenced by add(), and arguments().


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