CAPD DynSys Library 5.2.0
capd::auxil Namespace Reference

Classes

class  ApplicationDesc
 
class  argelement
 This is a helper class which defines common properties of a command-line argument bound with any type of a variable. More...
 
class  argflags
 This is a helper class which defines specific flags indicating various types of command-line arguments and the state of interpreting them. More...
 
class  arguments
 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. More...
 
class  argunit
 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...
 
class  BuildInfo
 
class  CAPDConfig
 
class  ComposedFunctor
 
class  ConfigFileReader
 
class  Counter
 Counter add to each object of given class unique id and also counts number of objects created and existing. More...
 
class  Functor
 
class  Logger
 
class  OutputStream
 This class defines an output stream for replacing the standard 'cout'. It has the additional features of flushing the output after every operation, suppressing the output, or logging the output to a file. More...
 
struct  RemoveConst
 
struct  RemoveConst< const T >
 
class  timeused
 A class that stores the time at which it was initialized and then returns or displays the time used since the initialization. It displays this time when the destructor is invoked, e.g., at the end of program run. This class is used in most of the CHomP programs to measure the time used for the computations. More...
 

Functions

std::ostream & operator<< (std::ostream &out, const argelement &p)
 
template<class type >
int readfromstring (char *str, type &t)
 A template for reading a variable from a string. Returns 0 on success, -1 on failure. More...
 
int readfromstring (char *str, char *&t)
 A specialization of the above template for interpreting a string as a string (no processing is necessary). More...
 
int readfromstring (char *str, const char *&t)
 A specialization of the above template for interpreting a string as a const string (no processing is necessary). More...
 
int readfromstring (char *str, bool &t)
 A specialization of the above template for reading a bool type. More...
 
template<class type >
void arg (arguments &a, const char *name, type &value)
 Adds a command line argument. The actual argument name consists of the dash and its name provided to the function. If name == 0, then the value of this argument is read directly from the command line without any preceding string. The value variable is filled in by the value read from the command line string using the operator >>. More...
 
template<class type >
void arg (arguments &a, const char *name, type &value, type defaultvalue)
 Adds a command line argument with a default value. The name must be nonempty. If the name of the argument appears but its value is not specified, then the default value is used instead. More...
 
void arg (arguments &a, const char *name, char *&value, const char *defaultvalue)
 A specialization of the above for C-style strings. More...
 
template<class type >
void arg (arguments &a, const char *name, type *value, int &count, int size)
 Adds a command line argument whose repeated occurrences fill in consecutive elements of the given array. The counter indicates the position in the array. The given size of the array will not be exceeded. More...
 
template<class type >
void arg (arguments &a, const char *name, type *value, int &count, int size, type defaultvalue)
 A version of the above with a default value of the arguments. More...
 
template<class type >
void argoblig (arguments &arg, const char *name, type &value)
 Defines an obligatory command line argument. If this argument does not appear, then an error is displayed and error code is returned by the analysis procedure. More...
 
template<class type >
void argoblig (arguments &arg, const char *name, type &value, type defaultvalue)
 A version of the above with the default value provided. More...
 
void argoblig (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for reading an array of argument values. More...
 
template<class type >
void argbreak (arguments &arg, const char *name, type &value)
 Adds an argument whose appearence interrupts the analysis of the command line and makes the analyzing function return the value of 1. This is useful for arguments whose appearence should make the program ignore all the remaining arguments, e.g., to display help information. More...
 
template<class type >
void argbreak (arguments &arg, const char *name, type &value, type defaultvalue)
 A version of the above with the default value provided. More...
 
void argbreak (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for the C-style string. More...
 
void argbreak (arguments &arg, const char *name)
 A version of the above which ignores the value of the argument. More...
 
template<class type >
void argswitch (arguments &arg, const char *name, type &value, const type &defaultvalue)
 Defines a command line argument which is a switch, that is, there is no value given for it in the command line. The appearence of this argument sets the predefined default value to the given variable. More...
 
void argswitch (arguments &arg, const char *name, char *&value, const char *defaultvalue)
 A version of the above for the C-style string. More...
 
void argswitch (arguments &arg, const char *name)
 Defines an ignored switch (no value is set when this argument appears). More...
 
void arghelp (arguments &a)
 Adds the typical arguments which should make the program display help information. If help is requested, the command line analysis is interrupted, and the procedure returns the value 1. More...
 
std::string commandline (int argc, char *argv[])
 Returns the entire command line as a single string. More...
 
const char * currenttime (void)
 Retrieves the current time as a pointer to a C-style string. More...
 
std::istream & operator>> (std::istream &ins, ConfigFileReader &d)
 
std::ostream & operator<< (std::ostream &outs, const ConfigFileReader &d)
 
template<class Op2 , class Op1 >
ComposedFunctor< Op2, Op1 > operator* (const Op2 &op2, const Op1 &op1)
 
template<class T1 >
void ignoreUnused (const T1 &)
 
template<class T1 , class T2 >
void ignoreUnused (const T1 &, const T2 &)
 
template<class T1 , class T2 , class T3 >
void ignoreUnused (const T1 &, const T2 &, const T3 &)
 
template<class T1 , class T2 , class T3 , class T4 >
void ignoreUnused (const T1 &, const T2 &, const T3 &, const T4 &)
 
template<class T1 , class T2 , class T3 , class T4 , class T5 >
void ignoreUnused (const T1 &, const T2 &, const T3 &, const T4 &, const T5 &)
 
template<typename type >
OutputStreamoperator<< (OutputStream &out, const type &object)
 The operator << for writing any kind of object to the output stream. This object is written using the operator << of the standard stream. More...
 
OutputStreamoperator<< (OutputStream &out, const char *object)
 A specialization of the operator << for writing a C-style string to the output stream. More...
 
OutputStreamoperator<< (OutputStream &out, std::ostream &(*object)(std::ostream &))
 A specialization of the operator << for putting manipulators (like std::endl, std::flush) to the output stream. More...
 
std::ostream & operator<< (std::ostream &out, const ApplicationDesc &desc)
 
std::ostream & operator<< (std::ostream &out, arguments &p)
 
std::ostream & operator<< (std::ostream &out, const BuildInfo &buildInfo)
 
double currentcpu ()
 
std::ostream & showseconds (std::ostream &out, double seconds, int precision)
 
std::ostream & operator<< (std::ostream &out, const timeused &t)
 

Function Documentation

◆ arg() [1/5]

void capd::auxil::arg ( arguments a,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A specialization of the above for C-style strings.

◆ arg() [2/5]

template<class type >
void capd::auxil::arg ( arguments a,
const char *  name,
type &  value 
)
inline

Adds a command line argument. The actual argument name consists of the dash and its name provided to the function. If name == 0, then the value of this argument is read directly from the command line without any preceding string. The value variable is filled in by the value read from the command line string using the operator >>.

◆ arg() [3/5]

template<class type >
void capd::auxil::arg ( arguments a,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

Adds a command line argument with a default value. The name must be nonempty. If the name of the argument appears but its value is not specified, then the default value is used instead.

◆ arg() [4/5]

template<class type >
void capd::auxil::arg ( arguments a,
const char *  name,
type *  value,
int count,
int  size 
)
inline

Adds a command line argument whose repeated occurrences fill in consecutive elements of the given array. The counter indicates the position in the array. The given size of the array will not be exceeded.

◆ arg() [5/5]

template<class type >
void capd::auxil::arg ( arguments a,
const char *  name,
type *  value,
int count,
int  size,
type  defaultvalue 
)
inline

A version of the above with a default value of the arguments.

◆ argbreak() [1/4]

void capd::auxil::argbreak ( arguments arg,
const char *  name 
)
inline

A version of the above which ignores the value of the argument.

◆ argbreak() [2/4]

void capd::auxil::argbreak ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for the C-style string.

◆ argbreak() [3/4]

template<class type >
void capd::auxil::argbreak ( arguments arg,
const char *  name,
type &  value 
)
inline

Adds an argument whose appearence interrupts the analysis of the command line and makes the analyzing function return the value of 1. This is useful for arguments whose appearence should make the program ignore all the remaining arguments, e.g., to display help information.

◆ argbreak() [4/4]

template<class type >
void capd::auxil::argbreak ( arguments arg,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

A version of the above with the default value provided.

◆ arghelp()

void capd::auxil::arghelp ( arguments a)
inline

Adds the typical arguments which should make the program display help information. If help is requested, the command line analysis is interrupted, and the procedure returns the value 1.

◆ argoblig() [1/3]

void capd::auxil::argoblig ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for reading an array of argument values.

◆ argoblig() [2/3]

template<class type >
void capd::auxil::argoblig ( arguments arg,
const char *  name,
type &  value 
)
inline

Defines an obligatory command line argument. If this argument does not appear, then an error is displayed and error code is returned by the analysis procedure.

◆ argoblig() [3/3]

template<class type >
void capd::auxil::argoblig ( arguments arg,
const char *  name,
type &  value,
type  defaultvalue 
)
inline

A version of the above with the default value provided.

◆ argswitch() [1/3]

void capd::auxil::argswitch ( arguments arg,
const char *  name 
)
inline

Defines an ignored switch (no value is set when this argument appears).

◆ argswitch() [2/3]

void capd::auxil::argswitch ( arguments arg,
const char *  name,
char *&  value,
const char *  defaultvalue 
)
inline

A version of the above for the C-style string.

◆ argswitch() [3/3]

template<class type >
void capd::auxil::argswitch ( arguments arg,
const char *  name,
type &  value,
const type &  defaultvalue 
)
inline

Defines a command line argument which is a switch, that is, there is no value given for it in the command line. The appearence of this argument sets the predefined default value to the given variable.

◆ commandline()

std::string capd::auxil::commandline ( int  argc,
char *  argv[] 
)
inline

Returns the entire command line as a single string.

◆ currentcpu()

double capd::auxil::currentcpu ( )
inline

◆ currenttime()

const char * capd::auxil::currenttime ( void  )
inline

Retrieves the current time as a pointer to a C-style string.

◆ ignoreUnused() [1/5]

template<class T1 >
void capd::auxil::ignoreUnused ( const T1 &  )
inline

◆ ignoreUnused() [2/5]

template<class T1 , class T2 >
void capd::auxil::ignoreUnused ( const T1 &  ,
const T2 &   
)
inline

◆ ignoreUnused() [3/5]

template<class T1 , class T2 , class T3 >
void capd::auxil::ignoreUnused ( const T1 &  ,
const T2 &  ,
const T3 &   
)
inline

◆ ignoreUnused() [4/5]

template<class T1 , class T2 , class T3 , class T4 >
void capd::auxil::ignoreUnused ( const T1 &  ,
const T2 &  ,
const T3 &  ,
const T4 &   
)
inline

◆ ignoreUnused() [5/5]

template<class T1 , class T2 , class T3 , class T4 , class T5 >
void capd::auxil::ignoreUnused ( const T1 &  ,
const T2 &  ,
const T3 &  ,
const T4 &  ,
const T5 &   
)
inline

◆ operator*()

template<class Op2 , class Op1 >
ComposedFunctor< Op2, Op1 > capd::auxil::operator* ( const Op2 &  op2,
const Op1 &  op1 
)
inline

◆ operator<<() [1/9]

OutputStream & capd::auxil::operator<< ( OutputStream out,
const char *  object 
)
inline

A specialization of the operator << for writing a C-style string to the output stream.

◆ operator<<() [2/9]

template<typename type >
OutputStream & capd::auxil::operator<< ( OutputStream out,
const type &  object 
)
inline

The operator << for writing any kind of object to the output stream. This object is written using the operator << of the standard stream.

◆ operator<<() [3/9]

OutputStream & capd::auxil::operator<< ( OutputStream out,
std::ostream &(*)(std::ostream &)  object 
)
inline

A specialization of the operator << for putting manipulators (like std::endl, std::flush) to the output stream.

◆ operator<<() [4/9]

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

◆ operator<<() [5/9]

std::ostream & capd::auxil::operator<< ( std::ostream &  out,
const ApplicationDesc desc 
)

◆ operator<<() [6/9]

std::ostream & capd::auxil::operator<< ( std::ostream &  out,
const argelement p 
)
inline

◆ operator<<() [7/9]

std::ostream & capd::auxil::operator<< ( std::ostream &  out,
const BuildInfo buildInfo 
)

◆ operator<<() [8/9]

std::ostream & capd::auxil::operator<< ( std::ostream &  out,
const timeused t 
)

◆ operator<<() [9/9]

std::ostream & capd::auxil::operator<< ( std::ostream &  outs,
const ConfigFileReader d 
)
inline

◆ operator>>()

std::istream & capd::auxil::operator>> ( std::istream &  ins,
ConfigFileReader d 
)
inline

◆ readfromstring() [1/4]

int capd::auxil::readfromstring ( char *  str,
bool t 
)
inline

A specialization of the above template for reading a bool type.

◆ readfromstring() [2/4]

int capd::auxil::readfromstring ( char *  str,
char *&  t 
)
inline

A specialization of the above template for interpreting a string as a string (no processing is necessary).

◆ readfromstring() [3/4]

int capd::auxil::readfromstring ( char *  str,
const char *&  t 
)
inline

A specialization of the above template for interpreting a string as a const string (no processing is necessary).

◆ readfromstring() [4/4]

template<class type >
int capd::auxil::readfromstring ( char *  str,
type &  t 
)
inline

A template for reading a variable from a string. Returns 0 on success, -1 on failure.

◆ showseconds()

std::ostream & capd::auxil::showseconds ( std::ostream &  out,
double  seconds,
int  precision 
)
inline