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

filter exceptions

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: 1810
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 354f805b
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.cc,v 1.2 2005-07-04 15:58:37 tforb Exp $
* $Id: filter.cc,v 1.3 2005-07-05 10:51:43 tforb Exp $
* \author Thomas Forbriger
* \date 30/06/2005
*
......@@ -19,8 +19,9 @@
#define TF_FILTER_CC_VERSION \
"TF_FILTER_CC V1.0 "
#define TF_FILTER_CC_CVSID \
"$Id: filter.cc,v 1.2 2005-07-04 15:58:37 tforb Exp $"
"$Id: filter.cc,v 1.3 2005-07-05 10:51:43 tforb Exp $"
#include<iostream>
#include <tsxx/filter.h>
namespace ts {
......@@ -35,6 +36,16 @@ namespace ts {
return s;
}
void Exception::report() const {
this->Tbase::report();
}
void UnknownFilterException::report() const {
this->Tbase::report();
std::cerr << "requested filter type: \"" << Mfilter << "\""
<< std::endl;
}
} // namespace filter
} // namespace ts
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: filter.h,v 1.5 2005-07-05 09:35:49 tforb Exp $
* $Id: filter.h,v 1.6 2005-07-05 10:51:43 tforb Exp $
* \author Thomas Forbriger
* \date 30/06/2005
*
......@@ -23,11 +23,13 @@
#define TF_FILTER_H_VERSION \
"TF_FILTER_H V1.0 "
#define TF_FILTER_H_CVSID \
"$Id: filter.h,v 1.5 2005-07-05 09:35:49 tforb Exp $"
"$Id: filter.h,v 1.6 2005-07-05 10:51:43 tforb Exp $"
#include<list>
#include<string>
#include<tsxx/tsxx.h>
#include<tfxx/handle.h>
#include<tfxx/error.h>
namespace ts {
......@@ -75,12 +77,15 @@ namespace ts {
BasicFilter();
}; // class BasicFilter
//! handle to pass filters
typedef tfxx::Handle<BasicFilter> Tfilterhandle;
/*! filter collection
*/
class FilterCollection: public std::list<tfxx::Handle<BasicFilter> > {
class FilterCollection: public std::list<Tfilterhandle> {
public:
typedef BasicFilter Tfilter;
typedef tfxx::Handle<Tfilter> Tfilterhandle;
typedef ts::filter::Tfilterhandle Tfilterhandle;
typedef Tfilterhandle::Tobject Tfilter;
typedef std::list<Tfilterhandle> Tfilterlist;
typedef Tfilterlist Tbase;
typedef Ttimeseries::Tseries Tseries;
......@@ -93,10 +98,48 @@ namespace ts {
{ return this->operator()(Ttimeseries(s, Theader(s.header.dt))); }
}; // class FilterCollection
//! no-operation filter
class Noop: public BasicFilter {
public:
Ttimeseries operator()(const Ttimeseries& s) const { return s; }
}; // class Noop
//! exception class
class Exception: public tfxx::error::Exception {
public:
typedef tfxx::error::Exception Tbase;
Exception(const char* message,
const char* file,
const int& line,
const char* condition):
Tbase(message, file, line, condition)
{ this->Tbase::dont_report_on_construct(); }
virtual void report() const;
}; // class Exception
//! unknown filter exception
class UnknownFilterException: public Exception {
public:
typedef Exception Tbase;
UnknownFilterException(const char* message,
const char* file,
const int& line,
const std::string& filter):
Tbase(message, file, line, "filter type is unknown"),
Mfilter(filter) { }
virtual ~UnknownFilterException() { }
virtual void report() const;
private:
std::string Mfilter;
}; // UnknownFilterException
} // namespace filter
} // namespace ts
#define TSXX_UnknownFilterAbort(M, F) \
throw( ts::filter::UnknownFilterException ( M , __FILE__, __LINE__, F ))
#endif // TF_FILTER_H_VERSION (includeguard)
/* ----- END OF filter.h ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seifeclass.cc,v 1.3 2005-07-05 09:48:53 tforb Exp $
* $Id: seifeclass.cc,v 1.4 2005-07-05 10:51:43 tforb Exp $
* \author Thomas Forbriger
* \date 04/07/2005
*
......@@ -19,8 +19,9 @@
#define TF_SEIFECLASS_CC_VERSION \
"TF_SEIFECLASS_CC V1.0 "
#define TF_SEIFECLASS_CC_CVSID \
"$Id: seifeclass.cc,v 1.3 2005-07-05 09:48:53 tforb Exp $"
"$Id: seifeclass.cc,v 1.4 2005-07-05 10:51:43 tforb Exp $"
#include<sstream>
#include<tsxx/seifexx.h>
#include<tsxx/seifeclass.h>
......@@ -92,6 +93,25 @@ namespace ts {
ts::filter::Ttimeseries FIRST::operator()(const Ttimeseries& s) const
{ first(s); return s; }
/*----------------------------------------------------------------------*/
//! function to generate filter class
ts::filter::Tfilterhandle make_seife_filter(const std::string& s)
{
ts::filter::Tfilterhandle retval(new ts::filter::Noop());
std::string ID;
std::istringstream is(s);
is >> ID;
if (ID=="LPB") {
std::cout << "LPB" << std::endl;
} else if (ID=="HPB") {
std::cout << "HPB" << std::endl;
} else {
TSXX_UnknownFilterAbort("ts::seife::make_seife_filter", ID);
}
return(retval);
}
} // namespace seife
} // namespace ts
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: seifeclass.h,v 1.2 2005-07-05 09:35:50 tforb Exp $
* $Id: seifeclass.h,v 1.3 2005-07-05 10:51:43 tforb Exp $
* \author Thomas Forbriger
* \date 04/07/2005
*
......@@ -23,8 +23,9 @@
#define TF_SEIFECLASS_H_VERSION \
"TF_SEIFECLASS_H V1.0 "
#define TF_SEIFECLASS_H_CVSID \
"$Id: seifeclass.h,v 1.2 2005-07-05 09:35:50 tforb Exp $"
"$Id: seifeclass.h,v 1.3 2005-07-05 10:51:43 tforb Exp $"
#include<string>
#include<tsxx/filter.h>
namespace ts {
......@@ -187,6 +188,9 @@ namespace ts {
Ttimeseries operator()(const Ttimeseries& s) const;
}; // class FIRST
//! create a seife filter
ts::filter::Tfilterhandle make_seife_filter(const std::string& s);
} // namespace seife
} // namespace ts
......
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