SourceXtractorPlusPlus  0.10
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 
17 /*
18  * FitsFileManager.h
19  *
20  * Created on: Sep 19, 2019
21  * Author: mschefer
22  */
23 
24 #ifndef _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_
25 #define _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_
26 
27 #include <memory>
28 #include <string>
29 #include <list>
30 #include <unordered_map>
31 
32 #include <fitsio.h>
33 
34 
35 namespace SourceXtractor {
36 
38 public:
39 
41  virtual ~FitsFileManager();
42 
43  fitsfile* getFitsFile(const std::string& filename, bool writeable = false);
44 
45  void closeAllFiles();
46 
48  if (s_instance == nullptr) {
49  s_instance = std::make_shared<FitsFileManager>();
50  }
51  return s_instance;
52  }
53 
54 private:
55  fitsfile* openFitsFile(const std::string& filename, bool writeable) const;
56  void closeFitsFile(fitsfile* fptr) const;
57  void closeExtraFiles();
58 
59  struct FitsInfo {
60  fitsfile* m_file_pointer;
63  };
64 
66 
67  unsigned int m_max_open_files;
69 
71 };
72 
73 }
74 
75 #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