CAPD::DynSys Library  6.0.0
capd::auxil::argunit< type > Class Template Reference

This is a helper class which defines one command-line argument which is bound with some specific variable. It is an extension of the "argelement" class defined in terms of a template whose parameter is the type of the variable which is to be set based on the value provided in the command line. More...

#include <capd/auxil/arg.h>

Public Member Functions

 argunit (const char *_name, type &_value)
 The constructor of a command line argument bound with one variable. More...
 
 argunit (const char *_name, type &_value, type defaultvalue)
 The constructor of a command line argument bound with one variable which has a default value if none found in the command line. More...
 
 argunit (const char *_name, type *_value, int &_count, int _size)
 The constructor of a command line argument bound with an array of the given size. More...
 
 argunit (const char *_name, type *_value, int &_count, int _size, type defaultvalue)
 The constructor of a command line argument bound with an array of the given size; a default value is provided. More...
 
int setvalue (char *str, char *next)
 Sets the argument value from the text string. More...
 
void restore ()
 Restores the previous argument value (except for tables). More...
 
void show (std::ostream &out) const
 Displays the value and some information. More...
 
const char * getname () const
 Returns the name of the command-line argument. More...
 
char * getvalue (char *str)
 Returns the argument's value string from the argument string or returns 0 if it is not this argument. More...
 
void resetflags ()
 Resets the flags. More...
 
void set (int flag)
 Sets the given flag. More...
 
void unset (int flag)
 Unsets (clears) the given flag. More...
 
bool get (int flag) const
 Returns the value of the given flag. More...
 

Detailed Description

template<class type>
class capd::auxil::argunit< type >

This is a helper class which defines one command-line argument which is bound with some specific variable. It is an extension of the "argelement" class defined in terms of a template whose parameter is the type of the variable which is to be set based on the value provided in the command line.

Constructor & Destructor Documentation

◆ argunit() [1/4]

template<class type >
capd::auxil::argunit< type >::argunit ( const char *  _name,
type &  _value 
)
inline

The constructor of a command line argument bound with one variable.

◆ argunit() [2/4]

template<class type >
capd::auxil::argunit< type >::argunit ( const char *  _name,
type &  _value,
type  defaultvalue 
)
inline

The constructor of a command line argument bound with one variable which has a default value if none found in the command line.

◆ argunit() [3/4]

template<class type >
capd::auxil::argunit< type >::argunit ( const char *  _name,
type *  _value,
int &  _count,
int  _size 
)
inline

The constructor of a command line argument bound with an array of the given size.

◆ argunit() [4/4]

template<class type >
capd::auxil::argunit< type >::argunit ( const char *  _name,
type *  _value,
int &  _count,
int  _size,
type  defaultvalue 
)
inline

The constructor of a command line argument bound with an array of the given size; a default value is provided.

Member Function Documentation

◆ get()

bool capd::auxil::argelement::get ( int  flag) const
inlineinherited

Returns the value of the given flag.

◆ getname()

const char * capd::auxil::argelement::getname ( ) const
inlineinherited

Returns the name of the command-line argument.

◆ getvalue()

char * capd::auxil::argelement::getvalue ( char *  str)
inherited

Returns the argument's value string from the argument string or returns 0 if it is not this argument.

◆ resetflags()

void capd::auxil::argelement::resetflags ( )
inlineinherited

Resets the flags.

◆ restore()

template<class type >
void capd::auxil::argunit< type >::restore
virtual

Restores the previous argument value (except for tables).

Implements capd::auxil::argelement.

◆ set()

void capd::auxil::argelement::set ( int  flag)
inlineinherited

Sets the given flag.

◆ setvalue()

template<class type >
int capd::auxil::argunit< type >::setvalue ( char *  str,
char *  next 
)
inlinevirtual

Sets the argument value from the text string.

Implements capd::auxil::argelement.

◆ show()

template<class type >
void capd::auxil::argunit< type >::show ( std::ostream &  out) const
virtual

Displays the value and some information.

Implements capd::auxil::argelement.

◆ unset()

void capd::auxil::argelement::unset ( int  flag)
inlineinherited

Unsets (clears) the given flag.


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