CFEL - ASG Software Suite  2.5.0
CASS
file_reader.cpp
Go to the documentation of this file.
1 // Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file file_reader.cpp contains the base class for all file readers
5  *
6  * @author Lutz Foucar
7  */
8 
9 #include <sstream>
10 #include <stdexcept>
11 
12 #include <QtCore/QFileInfo>
13 
14 #include "file_reader.h"
15 
16 #include "lma_reader.h"
17 #include "txt_reader.h"
18 #include "raw_sss_reader.h"
19 #include "frms6_reader.h"
20 
21 #ifdef LCLSLIBRARY
22 #include "xtc_reader.h"
23 #endif
24 
25 using namespace cass;
26 using namespace std;
27 using namespace std::tr1;
28 
30 {
32  string type = info.suffix().toStdString();
33  shared_pointer ptr;
34  if (type == "lma")
36  else if (type == "txt")
37  ptr = shared_pointer(new TxtReader());
38  else if (type == "sss")
40  else if (type == "frms6")
42 #ifdef LCLSLIBRARY
43  else if (type == "xtc")
44  ptr = shared_pointer(new XtcReader());
45 #endif
46  else
47  throw invalid_argument("FileReader::instance: file reader type '" + type +
48  "' is unknown.");
49  /** set the filename */
50  ptr->filename(filename);
51  return ptr;
52 }
53 
class for reading lma files
Definition: lma_reader.h:32
contains class to read lma files
STL namespace.
contains class to read commercial ccd files created with Per Johnsonn's program
contains class to read xtc files
additional info
fromStdString(const std::string &str)
class for reading xtc files
Definition: xtc_reader.h:29
class for reading txt files
Definition: txt_reader.h:41
contains base class for all file readers
class for reading frms6 files
Definition: frms6_reader.h:32
contains class to read frms6 files created by Xonline.
static shared_pointer instance(const std::string &filename)
create an instance of the requested type
Definition: file_reader.cpp:29
class for reading commercial ccd files
std::tr1::shared_ptr< FileReader > shared_pointer
typedef the shared pointer of this
Definition: file_reader.h:28
contains class to read txt ascii files