CFEL - ASG Software Suite  2.5.0
CASS
file_input.h
Go to the documentation of this file.
1 // Copyright (C) 2009 - 2016 Lutz Foucar
2 
3 /**
4  * @file file_input.h file contains declaration of xtcfile input
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _FILEINPUT_H_
10 #define _FILEINPUT_H_
11 
12 #include <string>
13 
14 #include "input_base.h"
15 #include "cass.h"
16 #include "ringbuffer.hpp"
17 #include "cass_event.h"
18 #include "file_reader.h"
19 
20 namespace cass
21 {
22 /** forward declaration of the file processors */
23 class FileProcessor;
24 
25 /** File Input for cass
26  *
27  * This class will be used in offline modus. I will take an string that
28  * contains a filename. In the file that the filename points to has to be a
29  * list with files, that one wants to analyze.
30  * The filename name must be passed to the program with the -i parameter.
31  *
32  * For each file in the filelist it will open the file, and call the readers
33  * to extract the data from the file.
34  *
35  * @cassttng FileInput/{Parallelize}\n
36  * When true, it will read the files on the fileinput list in parallel.
37  * Default is false.
38  *
39  * @author Lutz Foucar
40  */
41 class FileInput : public InputBase
42 {
43 public:
44  /** create instance of this
45  *
46  * @param filelistname name of the file containing all files that should be
47  * processed
48  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
49  * @param ratemeter reference to the ratemeter to measure the rate of the input
50  * @param loadmeter reference to the ratemeter to measure the load of the input
51  * @param quitwhendone flag that tells this class that it should quit the
52  * Program when its done reading all events
53  * @param parent The parent QT Object of this class
54  */
55  static void instance(std::string filelistname,
57  Ratemeter &ratemeter,
58  Ratemeter &loadmeter,
59  bool quitwhendone,
60  QObject *parent=0);
61 
62  /** function with the main loop */
63  void runthis();
64 
65  /** load the parameters used for the multifile input */
66  void load();
67 
68  /** retrieve the averaged progress state of all file processors
69  *
70  * @return the processing progress
71  */
72  double progress();
73 
74  /** retrieve the number of processed events
75  *
76  * @return number of processed events
77  */
78  uint64_t eventcounter();
79 
80  /** retrieve the number of skipped processed events
81  *
82  * @return number of processed events
83  */
84  uint64_t skippedeventcounter();
85 
86 private:
87  /** constructor
88  *
89  * @param filelistname name of the file containing all files that should be
90  * processed
91  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
92  * @param ratemeter reference to the ratemeter to measure the rate of the input
93  * @param loadmeter reference to the ratemeter to measure the load of the input
94  * @param quitwhendone flag that tells this class that it should quit the
95  * Program when its done reading all events
96  * @param parent The parent QT Object of this class
97  */
98  FileInput(std::string filelistname,
100  Ratemeter &ratemeter,
101  Ratemeter &loadmeter,
102  bool quitwhendone,
103  QObject *parent=0);
104 
105  /** flag that tells the input should analyze the files in parallel */
107 
108  /** flag to tell the thread to quit when its done with all files */
110 
111  /** name of the file containing all files that we need to process */
112  std::string _filelistname;
113 
114  /** define the container for all file processors */
115  typedef std::vector<std::tr1::shared_ptr<FileProcessor> > fileProcessors_t;
116 
117  /** the file processor container */
118  fileProcessors_t _fProcs;
119 };
120 
121 }//end namespace cass
122 
123 #endif
std::vector< std::tr1::shared_ptr< FileProcessor > > fileProcessors_t
define the container for all file processors
Definition: file_input.h:115
bool _parallelize
flag that tells the input should analyze the files in parallel
Definition: file_input.h:106
uint64_t eventcounter()
retrieve the number of processed events
Definition: file_input.cpp:281
std::string _filelistname
name of the file containing all files that we need to process
Definition: file_input.h:112
class calculating a rate in Hz.
Definition: ratemeter.h:28
file contains declaration of the CASSEvent
uint64_t skippedeventcounter()
retrieve the number of skipped processed events
Definition: file_input.cpp:289
Input base class.
Definition: input_base.h:31
bool _quitWhenDone
flag to tell the thread to quit when its done with all files
Definition: file_input.h:109
double progress()
retrieve the averaged progress state of all file processors
Definition: file_input.cpp:273
A Ringbuffer, handles communication between Input and Worker Threads.
Definition: ringbuffer.hpp:52
contains base class for all file readers
file contains the ringbuffer class
file contains global definitions for project cass
fileProcessors_t _fProcs
the file processor container
Definition: file_input.h:118
static shared_pointer instance()
get the signelton instance
Definition: input_base.cpp:20
contains the base class for all input modules
File Input for cass.
Definition: file_input.h:41
void load()
load the parameters used for the multifile input
Definition: file_input.cpp:193
FileInput(std::string filelistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
constructor
Definition: file_input.cpp:180
void runthis()
function with the main loop
Definition: file_input.cpp:200