Commit dcd385fc authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1834
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent e7e90f03
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: misc.h,v 1.9 2002-11-22 16:14:31 forbrig Exp $
* $Id: misc.h,v 1.10 2005-07-08 07:07:58 tforb Exp $
* \author Thomas Forbriger
* \date 18/11/2002
*
......@@ -24,7 +24,7 @@
#define TF_MISC_H_VERSION \
"TF_MISC_H V1.0 "
#define TF_MISC_H_CVSID \
"$Id: misc.h,v 1.9 2002-11-22 16:14:31 forbrig Exp $"
"$Id: misc.h,v 1.10 2005-07-08 07:07:58 tforb Exp $"
// we include fstream, because all function are closely related to file I/O
// and file_magic definitely requires fstream
......@@ -276,6 +276,24 @@ void file_magic_write(std::ostream& os, const char* const cmagic,
} // namespace tfxx
/*======================================================================*/
// some misc macro functions
//
/*! \brief produce debug output
*
* \param C output will be generated if C == true
* \param N name of function
* \param M message to print
*/
#define TFXX_debug(C,N,M) \
if (C) { \
std::cerr << "DEBUG (" << N << ", " \
<< __FILE__ << " line #" << __LINE__ << "):" << std::endl \
<< " " << M << std::endl; \
std::cerr.flush(); \
}
#endif // TF_MISC_H_VERSION (includeguard)
/* ----- END OF misc.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: anyfilter.cc,v 1.2 2005-07-05 16:07:58 tforb Exp $
* $Id: anyfilter.cc,v 1.3 2005-07-08 07:07:58 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -19,19 +19,23 @@
#define TF_ANYFILTER_CC_VERSION \
"TF_ANYFILTER_CC V1.0 "
#define TF_ANYFILTER_CC_CVSID \
"$Id: anyfilter.cc,v 1.2 2005-07-05 16:07:58 tforb Exp $"
"$Id: anyfilter.cc,v 1.3 2005-07-08 07:07:58 tforb Exp $"
#include <sstream>
#include <tsxx/anyfilter.h>
#include <tsxx/filter.h>
#include <tsxx/seifeclass.h>
#include <tfxx/misc.h>
namespace ts {
namespace filter {
Tfilterhandle make_any_filter(const std::string& s)
Tfilterhandle make_any_filter(const std::string& s,
const bool& debug)
{
TFXX_debug(debug, "make_any_filter", "process " + s );
tfxx::error::Exception::dont_report_on_construct();
typedef Tfilterhandle Tfh;
Tfh fh(new Noop());
bool hot=true;
......@@ -39,12 +43,17 @@ namespace ts {
if (hot) {
hot=false;
try {
fh=make_filter(s);
fh=make_filter(s,debug);
}
catch (UnknownFilterException) {
hot=true;
TFXX_debug(debug, "make_any_filter",
"caught unknown filter exception from my own" );
}
catch (Exception e) {
TFXX_debug(debug, "make_any_filter",
"caught other exception from my own" );
tfxx::error::Exception::report_on_construct();
e.report();
throw;
}
......@@ -57,15 +66,24 @@ namespace ts {
}
catch (UnknownFilterException) {
hot=true;
TFXX_debug(debug, "make_any_filter",
"caught unknown filter exception from seife" );
}
catch (Exception e) {
TFXX_debug(debug, "make_any_filter",
"caught other exception from seife" );
tfxx::error::Exception::report_on_construct();
e.report();
throw;
}
}
if (hot) {
TFXX_debug(debug, "make_any_filter",
"still hot after seife and my own" );
tfxx::error::Exception::report_on_construct();
TSXX_UnknownFilterAbort("ts::filter::make_any_filter", s);
}
tfxx::error::Exception::report_on_construct();
return(fh);
}
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: anyfilter.h,v 1.1 2005-07-05 16:07:05 tforb Exp $
* $Id: anyfilter.h,v 1.2 2005-07-08 07:07:58 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -23,7 +23,7 @@
#define TF_ANYFILTER_H_VERSION \
"TF_ANYFILTER_H V1.0 "
#define TF_ANYFILTER_H_CVSID \
"$Id: anyfilter.h,v 1.1 2005-07-05 16:07:05 tforb Exp $"
"$Id: anyfilter.h,v 1.2 2005-07-08 07:07:58 tforb Exp $"
#include<string>
#include<tsxx/filterbase.h>
......@@ -33,7 +33,8 @@ namespace ts {
namespace filter {
//! combine all filters (seife and others)
Tfilterhandle make_any_filter(const std::string& s);
Tfilterhandle make_any_filter(const std::string& s,
const bool& debug=false);
} // namespace filter
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.cc,v 1.9 2005-07-06 10:05:06 tforb Exp $
* $Id: filter.cc,v 1.10 2005-07-08 07:07:59 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -19,7 +19,7 @@
#define TF_FILTER_CC_VERSION \
"TF_FILTER_CC V1.0 "
#define TF_FILTER_CC_CVSID \
"$Id: filter.cc,v 1.9 2005-07-06 10:05:06 tforb Exp $"
"$Id: filter.cc,v 1.10 2005-07-08 07:07:59 tforb Exp $"
#include <cmath>
#include <sstream>
......@@ -27,6 +27,7 @@
#include <aff/functions/avg.h>
#include <aff/seriesoperators.h>
#include <aff/subarray.h>
#include <tfxx/misc.h>
namespace ts {
......@@ -153,13 +154,16 @@ namespace ts {
/*----------------------------------------------------------------------*/
//! function to generate filter class
Tfilterhandle make_filter(const std::string& s)
Tfilterhandle make_filter(const std::string& s,
const bool& debug)
{
TFXX_debug(debug, "make_filter", "process " + s );
typedef Tfilterhandle Tfh;
Tfh fh(new Noop());
std::string ID;
std::istringstream is(s);
is >> ID;
TFXX_debug(debug, "make_filter", " filter ID is " + ID );
Tvalue v;
int n, n2, n3;
if (ID=="tre") {
......@@ -175,6 +179,7 @@ namespace ts {
fh=Tfh(new Scale(v));
} else if (ID=="add") {
is >> v;
TFXX_debug(debug, "make_filter", " filter is: Add(" << v << ")" );
fh=Tfh(new Add(v));
} else if (ID=="fbl") {
is >> n >> n2 >> n3;
......@@ -182,7 +187,8 @@ namespace ts {
} else if (ID=="rev") {
fh=Tfh(new Reverse());
} else {
TSXX_UnknownFilterAbort("ts::filter::make_filter", ID);
TFXX_debug(debug, "make_filter", " filter ID " + ID + " is unknown" );
TSXX_UnknownFilterAbort("ts::filter::make_filter", ID.c_str());
}
return(fh);
}
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.h,v 1.11 2005-07-06 10:05:06 tforb Exp $
* $Id: filter.h,v 1.12 2005-07-08 07:07:59 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -23,7 +23,7 @@
#define TF_FILTER_H_VERSION \
"TF_FILTER_H V1.0 "
#define TF_FILTER_H_CVSID \
"$Id: filter.h,v 1.11 2005-07-06 10:05:06 tforb Exp $"
"$Id: filter.h,v 1.12 2005-07-08 07:07:59 tforb Exp $"
#include<tsxx/filterbase.h>
......@@ -122,7 +122,8 @@ namespace ts {
}; // class Reverse
//! create a filter
ts::filter::Tfilterhandle make_filter(const std::string& s);
ts::filter::Tfilterhandle make_filter(const std::string& s,
const bool& debug=false);
} // namespace filter
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filterbase.cc,v 1.3 2005-07-07 11:23:44 tforb Exp $
* $Id: filterbase.cc,v 1.4 2005-07-08 07:07:59 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -19,20 +19,29 @@
#define TF_FILTERBASE_CC_VERSION \
"TF_FILTERBASE_CC V1.0 "
#define TF_FILTERBASE_CC_CVSID \
"$Id: filterbase.cc,v 1.3 2005-07-07 11:23:44 tforb Exp $"
"$Id: filterbase.cc,v 1.4 2005-07-08 07:07:59 tforb Exp $"
#include<iostream>
#include <iostream>
#include <tsxx/filterbase.h>
#include <tfxx/misc.h>
namespace ts {
namespace filter {
Ttimeseries FilterCollection::operator()(const Ttimeseries& s) const
Ttimeseries FilterCollection::operator()(const Ttimeseries& s,
const bool& debug) const
{
Tfilterlist::const_iterator i=this->Tfilterlist::begin();
while (i!=this->Tfilterlist::end())
{ (*i)->operator()(s); }
{
TFXX_debug(debug, "FilterCollection::operator()",
"apply filter" );
(*i)->operator()(s);
++i;
}
TFXX_debug(debug, "FilterCollection::operator()",
"applied all filters" );
return s;
}
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filterbase.h,v 1.3 2005-07-05 11:26:39 tforb Exp $
* $Id: filterbase.h,v 1.4 2005-07-08 07:07:59 tforb Exp $
* \author Thomas Forbriger
* \date 05/07/2005
*
......@@ -23,7 +23,7 @@
#define TF_FILTERBASE_H_VERSION \
"TF_FILTERBASE_H V1.0 "
#define TF_FILTERBASE_H_CVSID \
"$Id: filterbase.h,v 1.3 2005-07-05 11:26:39 tforb Exp $"
"$Id: filterbase.h,v 1.4 2005-07-08 07:07:59 tforb Exp $"
#include<list>
#include<string>
......@@ -95,7 +95,8 @@ namespace ts {
typedef Tfilterlist Tbase;
typedef Ttimeseries::Tseries Tseries;
typedef Ttimeseries::Theader Theader;
Ttimeseries operator()(const Ttimeseries& s) const;
Ttimeseries operator()(const Ttimeseries& s,
const bool& debug=false) const;
Ttimeseries operator()(const Tseries& s, const Tvalue& dt) const
{ return this->operator()(Ttimeseries(s, Theader(dt))); }
template <class H>
......@@ -117,8 +118,7 @@ namespace ts {
const char* file,
const int& line,
const char* condition):
Tbase(message, file, line, condition)
{ this->Tbase::dont_report_on_construct(); }
Tbase(message, file, line, condition) { }
virtual void report() const;
}; // class Exception
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: tidofi.cc,v 1.6 2005-07-07 13:08:06 tforb Exp $
* $Id: tidofi.cc,v 1.7 2005-07-08 07:07:59 tforb Exp $
* \author Thomas Forbriger
* \date 17/02/2004
*
......@@ -19,7 +19,7 @@
#define TIDOFI_VERSION \
"TIDOFI V1.0 time domain filter"
#define TIDOFI_CVSID \
"$Id: tidofi.cc,v 1.6 2005-07-07 13:08:06 tforb Exp $"
"$Id: tidofi.cc,v 1.7 2005-07-08 07:07:59 tforb Exp $"
#include <iostream>
#include <fstream>
......@@ -30,6 +30,7 @@
#include <tfxx/stringfunc.h>
#include <tfxx/rangestring.h>
#include <tfxx/rangelist.h>
#include <tfxx/misc.h>
#include <tsxx/anyfilter.h>
#include <datreadxx/readany.h>
#include <sffxx.h>
......@@ -215,6 +216,8 @@ int main(int iargc, char* argv[])
{
// skip comments
bool skip=false;
TFXX_debug(opt.debug, "main",
"skip " + *line + " if irrelevant" );
skip |= (line->substr(0,1)=="#");
skip |= (line->substr(0,3)=="rem");
skip |= (line->substr(0,3)=="end");
......@@ -228,11 +231,17 @@ int main(int iargc, char* argv[])
i=command.find(",",i+1);
}
commands.append(command);
filter.push_back(ts::filter::make_any_filter(command));
filter.push_back(ts::filter::make_any_filter(command, opt.debug));
}
else
{
TFXX_debug(opt.debug, "main",
"skip " + *line + "!" );
}
++line;
}
}
// TFXX_debug(opt.debug, "main", "STOP" ); exit(0);
/*----------------------------------------------------------------------*/
// prepare file FREE block
......@@ -359,15 +368,22 @@ int main(int iargc, char* argv[])
++itrace;
if ((!doselect) || traceranges.contains(itrace))
{
TFXX_debug(opt.debug, "main", "process trace #" << itrace );
if (opt.verbose)
{ std::cout << " process trace #" << itrace << std::endl; }
Tseries series;
is >> series;
sff::WID2 wid2;
is >> wid2;
filter(Ttimeseries(series, wid2.dt));
TFXX_debug(opt.debug, "main",
" series and WID2 are read");
filter(Ttimeseries(series, wid2.dt),opt.debug);
TFXX_debug(opt.debug, "main",
" series is filtered");
os << series;
os << wid2;
TFXX_debug(opt.debug, "main",
" series and WID are written");
if (is.hasinfo()) { sff::INFO info; is >> info; os << info; }
if (is.hasfree())
{
......@@ -378,9 +394,12 @@ int main(int iargc, char* argv[])
tracefree.append(commands);
os << tracefree;
}
TFXX_debug(opt.debug, "main",
"trace #" << itrace << " successfully processed");
}
else
{
TFXX_debug(opt.debug, "main", "skip trace #" << itrace );
if (opt.verbose)
{ std::cout << " skip trace #" << itrace << std::endl; }
is.skipseries();
......
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