SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FitsFileManager.h
Go to the documentation of this file.
1 /*
2  * FitsFileManager.h
3  *
4  * Created on: Sep 19, 2019
5  * Author: mschefer
6  */
7 
8 #ifndef _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_
9 #define _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_
10 
11 #include <memory>
12 #include <string>
13 #include <list>
14 #include <unordered_map>
15 
16 #include <fitsio.h>
17 
18 
19 namespace SourceXtractor {
20 
22 public:
23 
25  virtual ~FitsFileManager();
26 
27  fitsfile* getFitsFile(const std::string& filename, bool writeable = false);
28 
29  void closeAllFiles();
30 
32  if (s_instance == nullptr) {
33  s_instance = std::make_shared<FitsFileManager>();
34  }
35  return s_instance;
36  }
37 
38 private:
39  fitsfile* openFitsFile(const std::string& filename, bool writeable) const;
40  void closeFitsFile(fitsfile* fptr) const;
41  void closeExtraFiles();
42 
43  struct FitsInfo {
44  fitsfile* m_file_pointer;
47  };
48 
50 
51  unsigned int m_max_open_files;
53 
55 };
56 
57 }
58 
59 #endif /* _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_ */
std::unordered_map< std::string, FitsInfo > m_fits_files
static std::shared_ptr< FitsFileManager > getInstance()
void closeFitsFile(fitsfile *fptr) const
static std::shared_ptr< FitsFileManager > s_instance
STL class.
string filename
Definition: conf.py:63
STL class.
std::list< std::string > m_open_files
fitsfile * getFitsFile(const std::string &filename, bool writeable=false)
fitsfile * openFitsFile(const std::string &filename, bool writeable) const