GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReadSpek.h
Go to the documentation of this file.
1 #ifndef READSPEK_H_INCLUDED
2 #define READSPEK_H_INCLUDED
3 
4 #include <string>
5 #include <vector>
6 #include <fstream>
7 
8 // decode filename according to MultiHist convention
9 // read spectrum into own buffer
10 // SpecNameDecode and SpecNameEncode should not be here
11 
12 class ReadSpek
13 {
14  std::string specName;
15  std::string specFormat;
16  int specLength;
17  FILE *specFILE;
18  float *specData;
19 
20  bool ReadSpek_C(int nspec, bool uns);
21  bool ReadSpek_S(int nspec, bool uns);
22  bool ReadSpek_I(int nspec, bool uns);
23  bool ReadSpek_L(int nspec, bool uns);
24  bool ReadSpek_F(int nspec);
25  bool ReadSpek_D(int nspec);
26  bool ReadSpek_A(int nspec); // to be done
27  bool InitData(int slen);
28  //void StringTrim(std::string &str);
29  //bool StringTrim(std::string &str, const std::string& cmt);
30 
31 public:
32 
33  ReadSpek() : specName(""), specFormat(""), specLength(0), specFILE(NULL), specData(NULL) {}
34  ~ReadSpek();
35  bool Open(std::string sName, std::string sForm);
36  bool Close();
37  bool Read(int slen, int snum = 0);
38  float* Data() { return specData;}
39 
40 };
41 
42 bool SpecNameDecode(std::string sName, std::string& sForm, int& slen);
43 bool SpecNameDecode(std::string sName, std::string& sForm, std::vector<int>& vlen);
44 bool SpecNameEncode(std::string& sName, std::string sForm, int slen);
45 bool SpecNameEncode(std::string& sName, std::string sForm, std::vector<int> vlen);
46 
47 #endif // READSPEK_H_INCLUDED
ReadSpek()
Definition: ReadSpek.h:33
bool SpecNameDecode(std::string sName, std::string &sForm, int &slen)
Definition: ReadSpek.cpp:376
bool Read(int slen, int snum=0)
Definition: ReadSpek.cpp:58
bool Open(std::string sName, std::string sForm)
Definition: ReadSpek.cpp:10
bool Close()
Definition: ReadSpek.cpp:36
bool SpecNameEncode(std::string &sName, std::string sForm, int slen)
Definition: ReadSpek.cpp:439
~ReadSpek()
Definition: ReadSpek.cpp:27
float * Data()
Definition: ReadSpek.h:38