fisx
fisx_simplespecfile.h
1 #/*##########################################################################
2 #
3 # The fisx library for X-Ray Fluorescence
4 #
5 # Copyright (c) 2014-2016 European Synchrotron Radiation Facility
6 #
7 # This file is part of the fisx X-ray developed by V.A. Sole
8 #
9 # Permission is hereby granted, free of charge, to any person obtaining a copy
10 # of this software and associated documentation files (the "Software"), to deal
11 # in the Software without restriction, including without limitation the rights
12 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 # copies of the Software, and to permit persons to whom the Software is
14 # furnished to do so, subject to the following conditions:
15 #
16 # The above copyright notice and this permission notice shall be included in
17 # all copies or substantial portions of the Software.
18 #
19 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 # THE SOFTWARE.
26 #
27 #############################################################################*/
28 #ifndef FISX_SIMPLE_SPECFILE_H
29 #define FISX_SIMPLE_SPECFILE_H
30 #include <string>
31 #include <vector>
32 #include <map>
33 
34 namespace fisx
35 {
36 
37 #ifdef SCAN_CLASS
38 class SpecfileScan
39 {
40 public:
41  SpecfileScan(int number);
42  std::vector<std::string> getHeader();
43  std::vector<std::string> getHeader(std::string);
44  std::vector<std::string> getAllLabels();
45  std::map<std::string, std::vector<double>> getData();
46  std::vector<double> getDataColumn(int column);
47  std::vector<double> getDataRow(int row);
48 
49 private:
50  std::vector<std::string> scanBuffer;
51 };
52 #endif // SCAN_CLASS
53 
54 
56 {
57 public:
59  SimpleSpecfile(std::string fileName);
60  void setFileName(std::string fileName);
61  int getNumberOfScans();
62  std::vector<std::string> getScanHeader(int scanIndex);
63  std::vector<std::string> getScanLabels(int scanIndex);
64  // std::map<std::string, std::vector<double>> getScanData(int scanIndex);
65  std::vector<std::vector<double> > getScanData(int scanIndex);
66  //std::vector<double> getScanDataColumn(int scanIndex, std::string label);
67  //std::vector<double> getScanDataColumn(int scanIndex, int column);
68  //std::vector<double> getScanDataRow(int scanIndex, int row);
69  // it is the responsibility of the caller to delete the scan
70  // SpecfileScan* getScan(int scanNumber);
71 private:
72  std::string fileName;
73  // the starting and ending points of each scan
74  std::vector<std::pair<long, long> > scanFilePositions;
75  std::vector<std::streampos> scanPosition;
76 };
77 
78 } // namespace fisx
79 
80 #endif // FISX_SIMPLE_SPECFILE_H
Definition: fisx_element.cpp:34
Definition: fisx_simplespecfile.h:55