CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::Args Class Reference

#include <Args.hh>

Detailed Description

A class for reading command line arguments

Typical Usage: For command line input such as: casmtools -funcname -opt1 val11 val12 -opt2 val21 val22 val23 This class will create a list of the 'val' associated with each 'opt'

Special named '-opt' are: -PRIM, -CSPECS, -HSPECS, -LCSPECS, -STRUC, -MATRIX Also special are: -COORD (expects either 'FRAC' or 'CART') : -TOL (expects double) Other '-opt' are stored in 'keywords' and the associated Array of values can be accessed using Args::get_keyvals('key')

Collect command line arguments in an Array<string> object called '_args' Parse using: Args( Array<string> _args, cout);

Then access using: const std::string &get_function_name() const ; const Array<std::string> &get_prim_filenames() const ; const Array<std::string> &get_cspecs_filenames() const ; const Array<std::string> &get_hspecs_filenames() const ; const Array<std::string> &get_lcspecs_filenames() const ; const Array<std::string> &get_structure_filenames() const ; const Array<std::string> &get_matrix_filenames() const ; const Array<std::string> &get_keyvals(std::string key) const ; double get_tol() const ; COORD_TYPE get_coord_mode() const ;

If unexpected input is found, print the input so the user sees what went wrong: void print(std::ostream &out) const ;

Definition at line 44 of file Args.hh.

Public Member Functions

 Args ()
 
 Args (const Array< std::string > args, std::ostream &out)
 
void set (const Array< std::string > args, std::ostream &out)
 
void clear ()
 
bool is_ok () const
 
const std::string & get_function_name () const
 
const Array< std::string > & get_prim_filenames () const
 
const Array< std::string > & get_cspecs_filenames () const
 
const Array< std::string > & get_hspecs_filenames () const
 
const Array< std::string > & get_lcspecs_filenames () const
 
const Array< std::string > & get_structure_filenames () const
 
const Array< std::string > & get_matrix_filenames () const
 
const Array< std::string > & get_keyvals (std::string key) const
 
double get_tol () const
 
COORD_TYPE get_coord_mode () const
 
void set_function_name (const std::string &in)
 
void set_prim_filenames (const Array< std::string > &in)
 
void set_cspecs_filenames (const Array< std::string > &in)
 
void set_hspecs_filenames (const Array< std::string > &in)
 
void set_lcspecs_filenames (const Array< std::string > &in)
 
void set_structure_filenames (const Array< std::string > &in)
 
void set_matrix_filenames (const Array< std::string > &in)
 
void set_keyvals (const std::string &key, const Array< std::string > &invals)
 
Array< std::string > & get_prim_filenames ()
 
Array< std::string > & get_cspecs_filenames ()
 
Array< std::string > & get_hspecs_filenames ()
 
Array< std::string > & get_lcspecs_filenames ()
 
Array< std::string > & get_structure_filenames ()
 
Array< std::string > & get_matrix_filenames ()
 
void set_tol (double in)
 
void set_coord_mode (COORD_TYPE in)
 
void print (std::ostream &out) const
 

Private Attributes

bool all_ok
 
Array< std::string > input_file_options
 
Array< std::string > prim_filenames
 
Array< std::string > cspecs_filenames
 
Array< std::string > hspecs_filenames
 
Array< std::string > lcspecs_filenames
 
Array< std::string > structure_filenames
 
Array< std::string > matrix_filenames
 
Array< std::string > keywords
 
Array< Array< std::string > > values
 
Array< std::string > null_values
 
double tol
 
COORD_TYPE coord_mode
 
std::string function_name
 
Array< std::string > err_list
 

Constructor & Destructor Documentation

CASM::Args::Args ( )

Definition at line 9 of file Args.cc.

CASM::Args::Args ( const Array< std::string >  args,
std::ostream &  out 
)

Definition at line 12 of file Args.cc.

Member Function Documentation

void CASM::Args::clear ( )

Definition at line 153 of file Args.cc.

COORD_TYPE CASM::Args::get_coord_mode ( ) const

Definition at line 211 of file Args.cc.

const Array< std::string > & CASM::Args::get_cspecs_filenames ( ) const

Definition at line 184 of file Args.cc.

Array< std::string > & CASM::Args::get_cspecs_filenames ( )

Definition at line 256 of file Args.cc.

const std::string & CASM::Args::get_function_name ( ) const

Definition at line 177 of file Args.cc.

const Array< std::string > & CASM::Args::get_hspecs_filenames ( ) const

Definition at line 187 of file Args.cc.

Array< std::string > & CASM::Args::get_hspecs_filenames ( )

Definition at line 259 of file Args.cc.

const Array< std::string > & CASM::Args::get_keyvals ( std::string  key) const

Definition at line 199 of file Args.cc.

const Array< std::string > & CASM::Args::get_lcspecs_filenames ( ) const

Definition at line 190 of file Args.cc.

Array< std::string > & CASM::Args::get_lcspecs_filenames ( )

Definition at line 262 of file Args.cc.

const Array< std::string > & CASM::Args::get_matrix_filenames ( ) const

Definition at line 196 of file Args.cc.

Array< std::string > & CASM::Args::get_matrix_filenames ( )

Definition at line 268 of file Args.cc.

const Array< std::string > & CASM::Args::get_prim_filenames ( ) const

Definition at line 181 of file Args.cc.

Array< std::string > & CASM::Args::get_prim_filenames ( )

Definition at line 253 of file Args.cc.

const Array< std::string > & CASM::Args::get_structure_filenames ( ) const

Definition at line 193 of file Args.cc.

Array< std::string > & CASM::Args::get_structure_filenames ( )

Definition at line 265 of file Args.cc.

double CASM::Args::get_tol ( ) const

Definition at line 208 of file Args.cc.

bool CASM::Args::is_ok ( ) const

Definition at line 173 of file Args.cc.

void CASM::Args::print ( std::ostream &  out) const

Definition at line 282 of file Args.cc.

void CASM::Args::set ( const Array< std::string >  args,
std::ostream &  out 
)

Definition at line 17 of file Args.cc.

void CASM::Args::set_coord_mode ( COORD_TYPE  in)

Definition at line 275 of file Args.cc.

void CASM::Args::set_cspecs_filenames ( const Array< std::string > &  in)

Definition at line 225 of file Args.cc.

void CASM::Args::set_function_name ( const std::string &  in)

Definition at line 218 of file Args.cc.

void CASM::Args::set_hspecs_filenames ( const Array< std::string > &  in)

Definition at line 228 of file Args.cc.

void CASM::Args::set_keyvals ( const std::string &  key,
const Array< std::string > &  invals 
)

Definition at line 240 of file Args.cc.

void CASM::Args::set_lcspecs_filenames ( const Array< std::string > &  in)

Definition at line 231 of file Args.cc.

void CASM::Args::set_matrix_filenames ( const Array< std::string > &  in)

Definition at line 237 of file Args.cc.

void CASM::Args::set_prim_filenames ( const Array< std::string > &  in)

Definition at line 222 of file Args.cc.

void CASM::Args::set_structure_filenames ( const Array< std::string > &  in)

Definition at line 234 of file Args.cc.

void CASM::Args::set_tol ( double  in)

Definition at line 272 of file Args.cc.

Member Data Documentation

bool CASM::Args::all_ok
private

Definition at line 45 of file Args.hh.

COORD_TYPE CASM::Args::coord_mode
private

Definition at line 67 of file Args.hh.

Array<std::string> CASM::Args::cspecs_filenames
private

Definition at line 53 of file Args.hh.

Array<std::string> CASM::Args::err_list
private

Definition at line 75 of file Args.hh.

std::string CASM::Args::function_name
private

Definition at line 71 of file Args.hh.

Array<std::string> CASM::Args::hspecs_filenames
private

Definition at line 54 of file Args.hh.

Array<std::string> CASM::Args::input_file_options
private

Definition at line 50 of file Args.hh.

Array<std::string> CASM::Args::keywords
private

Definition at line 60 of file Args.hh.

Array<std::string> CASM::Args::lcspecs_filenames
private

Definition at line 55 of file Args.hh.

Array<std::string> CASM::Args::matrix_filenames
private

Definition at line 57 of file Args.hh.

Array<std::string> CASM::Args::null_values
private

Definition at line 62 of file Args.hh.

Array<std::string> CASM::Args::prim_filenames
private

Definition at line 52 of file Args.hh.

Array<std::string> CASM::Args::structure_filenames
private

Definition at line 56 of file Args.hh.

double CASM::Args::tol
private

Definition at line 66 of file Args.hh.

Array< Array<std::string> > CASM::Args::values
private

Definition at line 61 of file Args.hh.


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