source: Sophya/trunk/SophyaExt/FitsIOServer/fabtwriter.h@ 1654

Last change on this file since 1654 was 1654, checked in by cmv, 24 years ago

Creation du FITS TOI reader et Writer (du pauvre) cmv 26/9/2001

File size: 2.2 KB
Line 
1/* Interface Fits BINARY/ASCII Table Writer cmv 26/09/2001 */
2#ifndef FABTWRITER_H_SEEN
3#define FABTWRITER_H_SEEN
4
5#include "machdefs.h"
6#include <iostream.h>
7#include <string.h>
8#include <string>
9
10#include "anydataobj.h"
11#include "tvector.h"
12#include "FitsIO/fitsio.h"
13
14#include <vector>
15
16namespace SOPHYA {
17
18//! Class for writing a FITS ASCII or BINARY table
19class FitsABTWriter : public AnyDataObj {
20public:
21 FitsABTWriter(string fname,int hdutype=BINARY_TBL,int lp=0);
22 FitsABTWriter(const char* cfname,int hdutype=BINARY_TBL,int lp=0);
23 virtual ~FitsABTWriter();
24
25 //! Add a new column to the FITS table and return its number (see addcol).
26 inline int AddCol(string label,int datatype=TDOUBLE
27 ,string tform=string(""),string tunit=string(""))
28 {return addcol(label.c_str(),datatype,tform.c_str(),tunit.c_str());}
29 //! Add a new column to the FITS table and return its number (see addcol).
30 inline int AddCol(const char* label,int datatype=TDOUBLE
31 ,const char* tform="",const char* tunit="")
32 {return addcol(label,datatype,tform,tunit);}
33
34 //! Set the FITS table extension name
35 inline void SetExtName(string extname=string("")) {ExtName = extname;}
36 //! Set the FITS table extension name
37 inline void SetExtName(char* extname="") {ExtName = extname;}
38 //! Set debug level
39 inline void SetDebug(int lp=0) {DbgLevel = (uint_2) lp;}
40
41 void Write(int col,long row,short val);
42 void Write(int col,long row,long val);
43 void Write(int col,long row,float val);
44 void Write(int col,long row,double val);
45 //! Return the number of overflows managed by cfitsio
46 inline uint_4 GetNOverFlow(void) {return NOverFlow;}
47
48protected:
49 void createfits(const char *cfname,int hdutype,int lp);
50 int addcol(const char* label,int datatype
51 ,const char* tform,const char* tunit);
52 void createtbl(void);
53 void printerrorwrite(char* type,int col,long row,int sta);
54 void printerror(int sta) const;
55
56 string FitsFN,ExtName;
57 int HduType;
58 uint_2 DbgLevel;
59 fitsfile *FitsPtr;
60 bool FirstTime;
61 vector<string> Label;
62 vector<int> DataType;
63 vector<string> TForm;
64 vector<string> TUnit;
65 uint_4 NOverFlow;
66};
67
68} // namespace SOPHYA
69#endif /* FABTWRITER_H_SEEN */
Note: See TracBrowser for help on using the repository browser.