Fourier library: Operations in the Fourier domain

◆ main()

int main ( int  iargc,
char *  argv[] 
)

Definition at line 109 of file cxxfftwtest.cc.

References CXXFFTWTEST_VERSION, Options::debug, FOURIER_assert, Options::m, Options::n, process(), and Options::verbose.

110 {
111 
112  // define usage information
113  char usage_text[]=
114  {
116  "usage: cxxfftwtest [-n n] [-m f]" "\n"
117  " or: cxxfftwtest --help|-h" "\n"
118  };
119 
120  // define full help text
121  char help_text[]=
122  {
123  "\n"
124  "-n n set number of samples to n\n"
125  "-m f set frequency to f\n"
126  };
127 
128  // define commandline options
129  using namespace tfxx::cmdline;
130  static Declare options[]=
131  {
132  // 0: print help
133  {"help",arg_no,"-"},
134  // 1: verbose mode
135  {"v",arg_no,"-"},
136  // 2: debug mode
137  {"DEBUG",arg_no,"-"},
138  // 3: number of samples
139  {"n",arg_yes,"50"},
140  // 4: frequency
141  {"m",arg_yes,"3"},
142  {NULL}
143  };
144 
145  // no arguments? print usage...
146  if (iargc<1)
147  {
148  cerr << usage_text << endl;
149  exit(0);
150  }
151 
152  // collect options from commandline
153  Commandline cmdline(iargc, argv, options);
154 
155  // help requested? print full help text...
156  if (cmdline.optset(0))
157  {
158  cerr << usage_text << endl;
159  cerr << help_text << endl;
160  exit(0);
161  }
162 
163  Options opt;
164  opt.verbose=cmdline.optset(1);
165  opt.debug=cmdline.optset(2);
166  opt.n=cmdline.int_arg(3);
167  opt.m=cmdline.int_arg(4);
168 
169  FOURIER_assert(opt.n>0, "illegal number of samples")
170  FOURIER_assert(opt.m>0, "illegal frequency")
171 
172  process(opt.n, opt.m, opt.verbose, opt.debug);
173 }
#define FOURIER_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:141
#define CXXFFTWTEST_VERSION
Definition: cxxfftwtest.cc:35
bool debug
Definition: cxxfftwtest.cc:103
bool verbose
void process(int n, int m, const bool &verbose, const bool &debug)
Definition: cxxfftwtest.cc:68
Here is the call graph for this function: