FACT++  1.0
Fits.h
Go to the documentation of this file.
1 #ifndef FACT_Fits
2 #define FACT_Fits
3 
4 #include "Description.h"
5 #include "FitsFile.h"
6 
7 class Converter;
8 
9 using namespace std;
10 
11 class Fits
12 {
13 private:
15  string fFileName;
16 
20  vector<Description> fStandardColDesc;
22  vector<string> fStandardFormats;
24  vector<void*> fStandardPointers;
26  vector<int> fStandardNumBytes;
27 
29  vector<Description> fDataColDesc;
30  //Description of the table
31  string fTableDesc;
33  vector<string> fDataFormats;
34 
36  vector<char> fCopyBuffer;
38  double fEndMjD;
40  uint32_t* fNumOpenFitsFiles;
43 
45  bool WriteHeaderKeys();
46  //if a write error occurs
47  void MoveFileToCorruptedFile();
48 
49 
50 
51 public:
53  int32_t fRunNumber;
54 
55  Fits() : fFile(NULL),
56  fEndMjD(0.0),
57  fNumOpenFitsFiles(NULL),
58  fMess(NULL),
59  fRunNumber(0)
60  {}
61 
62  virtual ~Fits()
63  {
64  Close();
65  }
66 
68  bool IsOpen() const { return fFile != NULL && fFile->IsOpen(); }
69 
71  void AddStandardColumn(const Description& desc, const string &dataFormat, void* dataPointer, long unsigned int numDataBytes);
72 
74  void InitDataColumns(const vector<Description> &desc, const vector<string>& dataFormat, MessageImp* out);
75 
77  bool Open(const string& fileName, const string& tableName, uint32_t* fitsCounter, MessageImp* out, int runNumber, CCfits::FITS *file=0);//ostream& out);
78 
80  bool Write(const Converter &conv, const void* data);
81 
83  void Close();
84 
86  void Flush();
87 
89  int GetWrittenSize() const;
90 
91  string GetName() const { return fFile ? fFile->GetName() : ""; }
92 
93 };//Fits
94 
95 
96 #endif /*FITS_H_*/
97 
98 // WriteToFITS vs Open/Close
vector< string > fDataFormats
the data format of the data columns
Definition: Fits.h:33
string fFileName
Definition: Fits.h:15
vector< char > fCopyBuffer
the copy buffer. Required to put the standard and data variable in contguous memory ...
Definition: Fits.h:36
bool IsOpen() const
Definition: FitsFile.h:97
The base implementation of a distributed messaging system.
Definition: MessageImp.h:10
string GetName() const
Definition: Fits.h:91
STL namespace.
Definition: Fits.h:11
vector< Description > fStandardColDesc
Definition: Fits.h:20
bool IsOpen() const
returns wether or not the file is currently open or not
Definition: Fits.h:68
A struct which stores a name, a unit and a comment.
Definition: Description.h:7
vector< void * > fStandardPointers
the pointers to the standard variables
Definition: Fits.h:24
string fTableDesc
Definition: Fits.h:31
virtual ~Fits()
Definition: Fits.h:62
MessageImp * fMess
were to log the errors
Definition: Fits.h:42
FITS writter for the FACT project.
Definition: FitsFile.h:9
FitsFile * fFile
Definition: Fits.h:14
uint32_t * fNumOpenFitsFiles
Keep track of number of opened fits.
Definition: Fits.h:40
float data[4 *1440]
string GetName() const
Definition: FitsFile.h:100
vector< int > fStandardNumBytes
the number of bytes taken by each standard variable
Definition: Fits.h:26
int32_t fRunNumber
current run number being logged
Definition: Fits.h:53
vector< string > fStandardFormats
Format of the standard columns.
Definition: Fits.h:22
vector< Description > fDataColDesc
the vector of data column names
Definition: Fits.h:29
A compiler for the DIM data format string.
Definition: Converter.h:16
double fEndMjD
to keep track of the time of the latest written entry (to update the header when closing the file) ...
Definition: Fits.h:38
Fits()
Definition: Fits.h:55