| 1 | /*    
 | 
|---|
| 2 |    --- SOPHYA software - FitsIOServer module ---
 | 
|---|
| 3 |    R. Ansari , 2005 
 | 
|---|
| 4 |    (C) UPS+LAL IN2P3/CNRS     (C) DAPNIA-SPP/CEA 
 | 
|---|
| 5 | */
 | 
|---|
| 6 | #ifndef FITSMANAGER_H
 | 
|---|
| 7 | #define FITSMANAGER_H
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #include "machdefs.h"
 | 
|---|
| 10 | #include <string>
 | 
|---|
| 11 | #include <iostream>
 | 
|---|
| 12 | #include "fitsinoutfile.h"
 | 
|---|
| 13 | 
 | 
|---|
| 14 | namespace SOPHYA {
 | 
|---|
| 15 | 
 | 
|---|
| 16 | class FitsHandlerInterface;
 | 
|---|
| 17 | 
 | 
|---|
| 18 | /*! 
 | 
|---|
| 19 |   \ingroup FitsIOServer
 | 
|---|
| 20 |   \brief Top level FITS I/O operations and handler management.
 | 
|---|
| 21 | */
 | 
|---|
| 22 | class FitsManager {
 | 
|---|
| 23 |  public:
 | 
|---|
| 24 |   //! Called once for each handler during init phase.
 | 
|---|
| 25 |   static int  RegisterHandler(FitsHandlerInterface * fhi, int glev=0, string desc="");
 | 
|---|
| 26 |   //! Print list of handlers on cout 
 | 
|---|
| 27 |   static int  ListHandlers();
 | 
|---|
| 28 |   //! Finds the appropriate handler and writes the object \b o to fits file \b os 
 | 
|---|
| 29 |   static void Write(FitsInOutFile& os, AnyDataObj & o);
 | 
|---|
| 30 |   //! Finds the appropriate handler and reads the object \b o from fits file \b is 
 | 
|---|
| 31 |   static void Read(FitsInOutFile& is, AnyDataObj & o);
 | 
|---|
| 32 |   //! Finds the appropriate reader for the current HDU and reads the data form \b is
 | 
|---|
| 33 |   static FitsHandlerInterface * Read(FitsInOutFile& is);
 | 
|---|
| 34 |   //! Scans the fits file and prints information about each HDU on formatted stream \b os
 | 
|---|
| 35 |   static int ScanFile(string filename, ostream& os, int slev=0);
 | 
|---|
| 36 |   //! Scans the fits file and prints information about each HDU on \b cout
 | 
|---|
| 37 |   static inline int ScanFile(string filename, int slev=0)
 | 
|---|
| 38 |     { return ScanFile(filename, cout, slev); }
 | 
|---|
| 39 | 
 | 
|---|
| 40 |  protected:
 | 
|---|
| 41 |   //! Finds the appropriate handler for the object \b o in the list of registered handlers.
 | 
|---|
| 42 |   static FitsHandlerInterface* FindHandler(AnyDataObj & o);
 | 
|---|
| 43 |   //! Finds the appropriate reader for the current HDU in the list of registered handlers.
 | 
|---|
| 44 |   static FitsHandlerInterface* FindReader(FitsInOutFile& is);
 | 
|---|
| 45 | };
 | 
|---|
| 46 | 
 | 
|---|
| 47 | } // Fin du namespace
 | 
|---|
| 48 | 
 | 
|---|
| 49 | #endif
 | 
|---|
| 50 | 
 | 
|---|