SourceXtractorPlusPlus  0.12
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 <vector>
31 #include <unordered_map>
32 
33 #include <fitsio.h>
34 
35 namespace SourceXtractor {
36 
37 class FitsFile;
38 
39 class FitsFileManager : public std::enable_shared_from_this<FitsFileManager> {
40 public:
41 
42  FitsFileManager(unsigned int max_open_files = 500);
43  virtual ~FitsFileManager();
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  std::shared_ptr<FitsFile> getFitsFile(const std::string& filename, bool writeable=false);
55 
56 private:
58 
59  unsigned int m_max_open_files;
61 
63 
64  void closeExtraFiles();
65 };
66 
67 }
68 
69 #endif /* _SEFRAMEWORK_FITS_FITSFILEMANAGER_H_ */
static std::shared_ptr< FitsFileManager > getInstance()
std::shared_ptr< FitsFile > getFitsFile(const std::string &filename, bool writeable=false)
static std::shared_ptr< FitsFileManager > s_instance
STL class.
string filename
Definition: conf.py:63
STL class.
std::list< std::string > m_open_files
FitsFileManager(unsigned int max_open_files=500)
std::unordered_map< std::string, std::shared_ptr< FitsFile > > m_fits_files