parse.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2005 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/MEAL/MEAL/parse.h
10
11#ifndef __MEAL_FileParse_H
12#define __MEAL_FileParse_H
13
14#include "stringtok.h"
15#include <fstream>
16
17namespace MEAL {
18
19 template< class T >
20 void parse (const std::string& filename, T* instance)
21 {
22 std::ifstream input (filename.c_str());
23 if (!input)
24 throw Error (FailedSys, "MEAL::parse", "ifstream (" + filename + ")");
25
26 std::string line;
27
28 while (!input.eof()) {
29
30 std::getline (input, line);
31 line = stringtok (line, "#\n", false); // get rid of comments
32
33 if (!line.length())
34 continue;
35
36 instance->parse (line);
37
38 }
39
40 }
41
42}
43
44#endif
45
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0