35 #define TF_FCOMMAND_CC_VERSION \ 36 "TF_FCOMMAND_CC V1.0 " 49 void FilterCommands::FilterCommands::help(std::ostream& os,
52 os <<
"filter library commands:" << endl;
53 os <<
"rem any comment (ignored)" << endl;
54 os <<
"# any comment (ignored)" << endl;
55 os <<
"dif differentiate" << endl;
56 os <<
"int integrate" << endl;
57 os <<
"lp2 in h second order low-pass" << endl;
58 os <<
"hp2 in h second order high-pass" << endl;
60 <<
"Butterworth low-pass of order ord" << endl;
62 <<
"Butterworth high-pass of order ord" << endl;
63 os <<
"fac factor mutiply by factor" << endl;
65 <<
"switch back to normal filters (default)" << endl;
66 os <<
"mod inverse switch to inverse filters" << endl;
68 <<
"switch to specification by period (default)" << endl;
69 os <<
"mod frequency switch to specification by frequency " << endl;
70 os <<
"end terminate file reading" << endl;
72 os <<
"\"in\" specifies the filter freqeuncy. It is either given" << endl;
73 os <<
"as a frequency (Hz) or as a period (s) depending on the" << endl;
74 os <<
"selected mode." << endl;
88 std::ifstream ifs(filename);
100 std::getline(is, line);
101 hot=
command(line.c_str(), verbose) && is.good();
109 if (verbose) cout <<
" set filter: " <<
command << endl;
112 std::istringstream cmdline(cmd);
117 if (token.find(
"rem")!=std::string::npos)
118 { }
else if (token.find(
"#")!=std::string::npos)
119 { }
else if (token.find(
"dif") != std::string::npos)
121 }
else if (token.find(
"int") != std::string::npos)
123 }
else if (token.find(
"lp2") != std::string::npos)
124 { cmdline >> par >> h;
setlp2(par, h);
125 }
else if (token.find(
"lpb") != std::string::npos)
126 { cmdline >> par >> ord;
setlpb(par, ord);
127 }
else if (token.find(
"hp2") != std::string::npos)
128 { cmdline >> par >> h;
sethp2(par, h);
129 }
else if (token.find(
"hpb") != std::string::npos)
130 { cmdline >> par >> ord;
sethpb(par, ord);
131 }
else if (token.find(
"fac") != std::string::npos)
133 }
else if (token.find(
"mod") != std::string::npos)
136 if (token.find(
"frequency")!=std::string::npos)
138 }
else if (token.find(
"period")!=std::string::npos)
140 }
else if (token.find(
"normal")!=std::string::npos)
142 }
else if (token.find(
"inverse")!=std::string::npos)
146 }
else if (token.find(
"end") != std::string::npos)
149 {
FOURIER_abort(
"ERROR (FilterCommands): illegal command!"); }
#define TF_FCOMMAND_H_VERSION
void setlpb(const Tcvalue &par, const int &ord)
void sethp2(const Tcvalue &par, const double &h)
void numfactor(const Tcvalue &factor)
evaluate filter commands (prototypes)
error handling for libfourier (prototypes)
void setlp2(const Tcvalue &par, const double &h)
#define FOURIER_abort(M)
Abort and give a message.
#define TF_FILTERS_H_VERSION
#define TF_POLESNZEROES_H_VERSION
bool command(const char *command, const bool &verbose=false)
void read(std::istream &is, const bool &verbose=false)
void sethpb(const Tcvalue &par, const int &ord)