ALTA  alpha
Public Member Functions | Static Public Member Functions | Friends | List of all members
alta::arguments Class Reference

#include <args.h>

Public Member Functions

 arguments (int argc, char **const argv)
 
bool is_defined (const std::string &key) const
 is the elements in the command line ?
 
bool is_vec (const std::string &key) const
 is the data at the given key in a vector format? No matter the type of the data, this function will test is the mapped string is of type "[ .... ]". It returns false if there is no associated entry.
 
std::string operator[] (const std::string &key) const
 access the element stored value
 
void update (const std::string &key, const std::string &val)
 update the value val stored under key key
 
std::string get_string (const std::string &key, std::string default_value="") const
 acces to the string value associated with the parameter More...
 
float get_float (const std::string &key, float default_value=0.0f) const
 acces to the float value associated with the parameter key. More...
 
double get_double (const std::string &key, double default_value=0.0) const
 access to the double value associated with the parameter key More...
 
int get_int (const std::string &key, int default_value=0) const
 acces to the integer value associated with the parameter key. More...
 
vec get_vec (const std::string &key, int size, float default_value=0.0f) const
 acces to a vector of float of size size associated with More...
 
template<typename T >
std::vector< T > get_vec (const std::string &key) const
 access a vector of element of type T of variable length. the string associated with the key key should have the form "[a, b, c]" where a, b, c are of type T.
 
std::vector< std::string > get_vec (const std::string &key) const
 
template<typename T >
std::pair< T, T > get_pair (const std::string &key) const
 access a pair of element of type T. the string associated with the key key should have the form "a b" where a, b are compatible with type T.
 
std::string get_cmd () const
 get the reconstructed command line arguments (without the executable name
 

Static Public Member Functions

static arguments create_arguments (const std::string &n)
 Create an argument object from a string describing a command line.
 
static arguments parse_header (std::istream &input)
 Parse a data file header. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const arguments &args)
 Friend function to display the content of an argument object.
 

Member Function Documentation

double alta::arguments::get_double ( const std::string &  key,
double  default_value = 0.0 
) const
inline

The default_value argument will be returned if the key has no associated value.

float alta::arguments::get_float ( const std::string &  key,
float  default_value = 0.0f 
) const
inline

The default_value argument will be returned if the key has no associated value.

int alta::arguments::get_int ( const std::string &  key,
int  default_value = 0 
) const
inline

The default_value argument will be returned if the key has no associated value.

std::string alta::arguments::get_string ( const std::string &  key,
std::string  default_value = "" 
) const
inline

key.

The default_value argument will be returned if the key has no associated value.

vec alta::arguments::get_vec ( const std::string &  key,
int  size,
float  default_value = 0.0f 
) const
inline

the parameter key.

The default_value argument will be returned if the key has no associated value.

static arguments alta::arguments::parse_header ( std::istream &  input)
inlinestatic

ALTA file header should appear at the beginning of each file. Each line starts with '#' and describe a couple key, value. For example, parametrizations are described as: PARAM_IN NAME

Note: A header should always start and ends by: ALTA HEADER BEGIN ALTA HEADER END


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