Xmipp  v3.23.11-Nereus
Classes
args.h File Reference
#include "xmipp_strings.h"
#include "xmipp_error.h"
Include dependency graph for args.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Matrix1D< T >
 

Functions

Read lists

These functions try to read N values of the desired type into the given structure (either a STL vector of any numerical type by adding the read values at the end or a Matrix1D of any numerical type and then the values are written at PHYSICAL positions 0 ... N-1, the Matrix1D must be big enough to hold all the data since it is not resized internally.

If it is not possible to read all parameters an exception is thrown. You can provide the exception in the function call but there are default values. These functions are based in those for reading single values, so it might be possible that these other functions throw other exceptions.

The different elements of the list are selected using the tokenizing functions (different elements in the string are separated by spaces), so after the application of this function to the input string, this is modified and NULL characters are introduced as delimiters of the elements.

The following code is an example of doing so:

getline(in_stream, line);
readFloatList(line, 10, v1); // Read 10 values from line in v1
readFloatList(NULL, 10, v2); // Read NEXT!! 10 values in v2
template<typename T >
void readFloatList (const char *str, int N, std::vector< T > &v)
 
template<typename T >
void readFloatList (const std::string &str, size_t &i, int N, std::vector< T > &v)
 
template<typename T >
void readFloatList (const char *str, int N, Matrix1D< T > &v, ErrorType _errno=ERR_VALUE_INCORRECT, std::string errmsg="Error reading floating list", int exit=0)
 
Functions for parsing the command line

These functions help you to manage the command line parameters

const char * getParameter (int argc, const char **argv, const char *param, const char *option=NULL)
 
bool getTwoDoubleParams (int argc, const char **argv, const char *param, double &v1, double &v2, double v1_def, double v2_def)
 
bool getThreeDoubleParams (int argc, const char **argv, const char *param, double &v1, double &v2, double &v3, double v1_def, double v2_def, double v3_def)
 
bool checkParameter (int argc, const char **argv, const char *param)
 
int paremeterPosition (int argc, const char **argv, const char *param)
 
int numComponents (const std::string &str)
 
Matrix1D< double > getVectorParameter (int argc, const char **argv, const char *param, int dim=2)
 
Matrix1D< double > getVectorParameter (FILE *fh, const char *param, int dim=2)
 
void generateCommandLine (const std::string &command_line, int &argcp, char **&argvp, char *&copy)
 
bool generateCommandLine (FILE *fh, const char *param, int &argcp, char **&argvp, char *&copy)
 
std::string getParameter (FILE *fh, const char *param, int skip=0, const char *option=NULL)
 
bool checkParameter (FILE *fh, const char *param)