TS++ library: time series library
anyfilter.cc
Go to the documentation of this file.
1 
34 #define TF_ANYFILTER_CC_VERSION \
35  "TF_ANYFILTER_CC V1.0 "
36 
37 #include <sstream>
38 #include <tsxx/anyfilter.h>
39 #include <tsxx/filter.h>
40 #include <tsxx/seifeclass.h>
41 #include <tsxx/debug.h>
42 
43 namespace ts {
44 
45  namespace filter {
46 
47  Tfilterhandle make_any_filter(const std::string& s,
48  const bool& debug)
49  {
50  TSXX_debug(debug, "make_any_filter", "process " + s );
51  tfxx::error::Exception::dont_report_on_construct();
52  typedef Tfilterhandle Tfh;
53  Tfh fh(new Noop());
54  bool hot=true;
56  if (hot) {
57  hot=false;
58  try {
59  fh=make_filter(s,debug);
60  }
61  catch (UnknownFilterException) {
62  hot=true;
63  TSXX_debug(debug, "make_any_filter",
64  "caught unknown filter exception from my own" );
65  }
66  catch (Exception e) {
67  TSXX_debug(debug, "make_any_filter",
68  "caught other exception from my own" );
69  tfxx::error::Exception::report_on_construct();
70  e.report();
71  throw;
72  }
73  }
75  if (hot) {
76  hot=false;
77  try {
78  fh=ts::seife::make_seife_filter(s, debug);
79  }
80  catch (UnknownFilterException) {
81  hot=true;
82  TSXX_debug(debug, "make_any_filter",
83  "caught unknown filter exception from seife" );
84  }
85  catch (Exception e) {
86  TSXX_debug(debug, "make_any_filter",
87  "caught other exception from seife" );
88  tfxx::error::Exception::report_on_construct();
89  e.report();
90  throw;
91  }
92  }
93  if (hot) {
94  TSXX_debug(debug, "make_any_filter",
95  "still hot after seife and my own" );
96  tfxx::error::Exception::report_on_construct();
97  TSXX_UnknownFilterAbort("ts::filter::make_any_filter", s);
98  }
99  tfxx::error::Exception::report_on_construct();
100  return(fh);
101  }
102 
104  void print_any_help(std::ostream& os)
105  {
107  os << std::endl;
109  }
110 
111  } // namespace filter
112 
113 } // namespace ts
114 
115 /* ----- END OF anyfilter.cc ----- */
tfxx::Handle< BasicFilter > Tfilterhandle
handle to pass filters
Definition: filterbase.h:93
debug macro (prototypes)
some time series filter classes (prototypes)
provide access to all filters (seife and other) (prototypes)
Tfilterhandle make_any_filter(const std::string &s, const bool &debug)
combine all filters (seife and others)
Definition: anyfilter.cc:47
#define TSXX_debug(C, N, M)
produce debug output
Definition: debug.h:51
unknown filter exception
Definition: filterbase.h:134
Tfilterhandle make_filter(std::string s, const bool &debug)
function to generate filter class
Definition: filter.cc:446
ts::filter::Tfilterhandle make_seife_filter(std::string s, const bool &debug)
function to generate filter class
Definition: seifeclass.cc:142
All stuff in this library will be placed within namespace ts.
Definition: anyfilter.cc:43
void print_any_help(std::ostream &os)
print information on available filters
Definition: anyfilter.cc:104
virtual void report() const
Definition: filterbase.cc:65
void print_help(std::ostream &os)
print usage information
Definition: seifeclass.cc:214
#define TSXX_UnknownFilterAbort(M, F)
Definition: filterbase.h:153
no-operation filter
Definition: filterbase.h:115
provide all needed to use BasicFilter with seife code (prototypes)
exception class
Definition: filterbase.h:122
void print_help(std::ostream &os)
print usage information
Definition: filter.cc:517