source: trunk/Mars/mfileio/MTopFitsGroup.h@ 14858

Last change on this file since 14858 was 14792, checked in by lyard, 12 years ago
Added fits output for MC data
File size: 2.0 KB
Line 
1#ifndef MARS_MTopFitsGroup
2#define MARS_MTopFitsGroup
3
4
5#include <sys/types.h>
6#include <sys/stat.h>
7
8#include "TString.h"
9
10//#include "astroroot.h"
11//#include "fitsio.h"
12#include "../mcore/fits.h"
13#include "../mcore/ofits.h"
14
15///////////////////////////////////////////////////////////////////////////////
16// An unique id of files. It is sortable, i. e. can be uses as a key in maps
17class MUniqueFileId
18{
19 dev_t fst_dev; // id of the device of this file
20 ino_t fst_ino; // inode number of the file on the device fst_dev
21
22public:
23 MUniqueFileId(dev_t st_dev, ino_t st_ino)
24 : fst_dev(st_dev), fst_ino(st_ino) {}
25
26 bool operator < (const MUniqueFileId & fileId) const
27 { if (fst_dev == fileId.fst_dev)
28 return fst_ino < fileId.fst_ino;
29 return fst_dev < fileId.fst_dev; }
30
31};
32
33///////////////////////////////////////////////////////////////////////////////
34// All information of one open Top Level FITS group
35class MTopFitsGroup
36{
37 // filename of the group, but expanded by ROOT
38 // ( see gSystem->ExpandPathName() )
39 TString fFileName;
40
41 // the top level group as AstroROOT-2 data structure
42 std::ofits* fTopGroup;
43
44 // number of usage of this group by different MWriteFitsFile instances
45 Int_t fNumOpen;
46
47public:
48 MTopFitsGroup(const char * fileName, std::ofits* file) : fFileName(fileName),
49 fTopGroup(file),
50 fNumOpen(1)
51 {}
52
53 void IncreaseUsage() {++fNumOpen;}
54 void DecreaseUsage() {--fNumOpen;}
55 Int_t GetNumUsage() {return fNumOpen;}
56
57 void Attach(std::ofits* table);
58 Bool_t GetNextChild(std::ofits* table);
59
60 std::ofits* GetGroup() {return fTopGroup;}
61 TString & GetFileName() {return fFileName;}
62
63};
64
65#endif
66
Note: See TracBrowser for help on using the repository browser.