Commit 769a6860 authored by thomas.forbriger's avatar thomas.forbriger

libstfinv [FEATURE]: support semicolon as field delimiter

Where several values in an argument to a parameter must be separated (like in
the 'irtap' option of the Fourier domain procedures) white space ( ), commas
(,), and semicolons (;) are allowed as field delimiters, at your convenience.

reason: libstfinv is used by IFOS2D and friends. The parameter file parser
used by these programs uses a comma to separate configuration parameters. This
conflicts with the meaning of a comma as field delimiter within on
configuration parameter.
parent e9b69fc6
......@@ -29,11 +29,12 @@
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
* - 18/01/2016 V1.1 rename function to secomtospace
*
* ============================================================================
*/
#define STFINV_PARAMETERHANDLER_CC_VERSION \
"STFINV_PARAMETERHANDLER_CC V1.0"
"STFINV_PARAMETERHANDLER_CC V1.1"
#include <algorithm>
#include <stfinv/parameterhandler.h>
......@@ -50,7 +51,7 @@ std::string stfinv::tools::clipstring(std::string& s, const std::string& delim)
s.erase();
}
return(result);
} // std::string stfinv::tools::clipstring^
} // std::string stfinv::tools::clipstring()
/*----------------------------------------------------------------------*/
......@@ -71,11 +72,12 @@ stfinv::tools::Tparamap stfinv::tools::makeparamap(const std::string& p,
/*----------------------------------------------------------------------*/
std::string stfinv::tools::commatospace(std::string s)
std::string stfinv::tools::secomtospace(std::string s)
{
std::replace(s.begin(), s.end(), ',', ' ');
std::replace(s.begin(), s.end(), ';', ' ');
return(s);
} // std::string stfinv::tools::commatospace(const std::string& s)
} // std::string stfinv::tools::secomtospace(const std::string& s)
/*----------------------------------------------------------------------*/
......
......@@ -29,6 +29,7 @@
*
* REVISIONS and CHANGES
* - 06/05/2011 V1.0 Thomas Forbriger
* - 18/01/2016 V1.1 rename function to secomtospace
*
* ============================================================================
*/
......@@ -37,7 +38,7 @@
#ifndef STFINV_PARAMETERHANDLER_H_VERSION
#define STFINV_PARAMETERHANDLER_H_VERSION \
"STFINV_PARAMETERHANDLER_H V1.0"
"STFINV_PARAMETERHANDLER_H V1.1"
#include <string>
#include <map>
......@@ -85,13 +86,14 @@ namespace stfinv {
/*----------------------------------------------------------------------*/
/*! replace comma by whitespace
/*! replace commas and semicolons by whitespace
* \ingroup group_tools
*
* \param s input string
* \return input string with all commas replaced by whitespace
* \return input string with all commas replaced by whitespace and
* all semicolons replaced by whitespace
*/
std::string commatospace(std::string s);
std::string secomtospace(std::string s);
/*----------------------------------------------------------------------*/
......
......@@ -255,7 +255,7 @@ namespace stfinv {
// taper definition
// ----------------
{
std::istringstream is(stfinv::tools::commatospace(
std::istringstream is(stfinv::tools::secomtospace(
this->parameter("irtap","0.,1.,2.,3.")));
is >> Mtt1 >> Mtt2 >> Mtt3 >> Mtt4;
}
......
......@@ -19,6 +19,10 @@ remainder may consist of several control parameters being separated by colons
or may come along with a parameter value. The value is separated from the
parameter by an equal sign (=).
Where several values in an argument to a parameter must be separated (like in
the 'irtap' option of the Fourier domain procedures) white space ( ), commas
(,), and semicolons (;) are allowed as field delimiters, at your convenience.
Examples:
- To select Fourier domain least squares and shift the returned source
correction filter wavelet by 0.4s and switch on verbose mode, pass the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment