Commit 29b9652f authored by henryjandrew's avatar henryjandrew

Merge branch 'develop' of https://git.rwth-aachen.de/ita/ITABase into develop

parents 6e8cd461 d05479e9
......@@ -78,6 +78,9 @@ namespace ITABase
*/
void Init( const int iLength, const float fSampleRate, const bool bZeroInit = true );
//! Set a dirac pulse / delta function (first sample 1, rest 0)
void SetDirac();
private:
//! Disable this Init method from sample buffer
......
......@@ -52,6 +52,7 @@ public:
bool StringToFloatVec( const std::string& s, std::vector<float>& v, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
bool StringToDoubleVec( const std::string& s, std::vector<double>& v, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
bool StringToStringVec( const std::string& s, std::vector< std::string >& v, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
void StringToDoubleVecNoRegex( const std::string& s, std::vector< double >& v );
private:
int m_iOpts;
......@@ -180,7 +181,7 @@ ITA_BASE_API std::vector<unsigned int> StringToUIntVec( const std::string& s, st
ITA_BASE_API std::vector<float> StringToFloatVec( const std::string& s, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
//! std::string nach double-Liste parsen (Parse-Fehler werden in ITAExceptions umgesetzt)
ITA_BASE_API std::vector<double> StringToDoubleVec( const std::string& s, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
ITA_BASE_API std::vector<double> StringToDoubleVec( const std::string& s );
//! std::string nach String-Liste parsen (Parse-Fehler werden in ITAExceptions umgesetzt)
ITA_BASE_API std::vector< std::string > StringToStringVec( const std::string& s, std::string sSeparatorRegex = "\\s*,\\s*", bool bMatchCase = true );
......
......@@ -40,3 +40,8 @@ float CFiniteImpulseResponse::GetNyquistFrequency() const
{
return GetSampleRate() / 2.0f;
}
void ITABase::CFiniteImpulseResponse::SetDirac()
{
Identity();
}
......@@ -8,6 +8,10 @@
#include <iomanip>
#include <numeric>
#include <sstream>
#include <iostream>
#include <string>
#include <iterator>
#include <vector>
#include <ITAConstants.h>
#include <ITAException.h>
......@@ -57,7 +61,7 @@ std::string nTimes( std::string s, unsigned int n )
return result;
}
std::string BoolToString( bool bValue )
std::string BoolToString( bool bValue )
{
std::stringstream ssStream;
ssStream << bValue;
......@@ -224,7 +228,7 @@ std::string ComplexFloatArrayToString( const float* pfValues, size_t count, int
std::string s;
if( count > 0 ) {
for( size_t i = 0; i < count; i++ ) {
if( i>0 ) s += sSeparator;
if( i > 0 ) s += sSeparator;
s += FloatToString( pfValues[ 2 * i ], iPrecision );
if( pfValues[ 2 * i + 1 ] < 0 )
s += FloatToString( pfValues[ 2 * i + 1 ], iPrecision ) + "i";
......@@ -346,9 +350,10 @@ std::vector<float> StringToFloatVec( const std::string& s, std::string sSeparato
return v;
}
std::vector<double> StringToDoubleVec( const std::string& s, std::string sSeparatorRegex, bool bMatchCase ) {
std::vector<double> v;
g_oDefaultConversion.StringToDoubleVec( s, v, sSeparatorRegex, bMatchCase );
std::vector<double> StringToDoubleVec( const std::string& s )
{
std::vector< double > v;
g_oDefaultConversion.StringToDoubleVecNoRegex( s, v );
return v;
}
......@@ -662,7 +667,26 @@ bool ITAConversion::StringToFloatVec( const std::string& s, std::vector<float>&
return true;
}
bool ITAConversion::StringToDoubleVec( const std::string& s, std::vector<double>& v, std::string sSeparatorRegex, bool bMatchCase ) {
template <class Container>
void split1( const std::string& str, Container& cont )
{
}
void ITAConversion::StringToDoubleVecNoRegex( const std::string& s, std::vector< double >& v )
{
v.clear();
std::string sDouble;
double dVal;
std::stringstream ss( s );
while( std::getline( ss, sDouble, ',' ) )
if( StringToDouble( sDouble, dVal ) )
v.push_back( dVal );
}
bool ITAConversion::StringToDoubleVec( const std::string& s, std::vector<double>& v, std::string sSeparatorRegex, bool bMatchCase )
{
// [fwe 2008-07-09] TODO: Diese Implementierung ist mal eben gebaut und hemdsärmelig! Verbessern!
pcrecpp::RE_Options re_opts;
re_opts.set_multiline( true );
......@@ -831,7 +855,7 @@ std::string timeToString( const double dSeconds )
}
*/
sprintf(buf, "%i min %0.1f s ", (int) dSeconds, fmodf((float) dSeconds, 60.0f));
sprintf( buf, "%i min %0.1f s ", ( int ) dSeconds, fmodf( ( float ) dSeconds, 60.0f ) );
return std::string( buf );
#endif // WIN32
}
......
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