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

Last change on this file since 1661 was 1660, checked in by cmv, 24 years ago
  • plus d'options et de possibilites + doc

cmv 30/9/01

File size: 2.3 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,string tform=string("")
27 ,string tunit=string(""),int datatype=TDOUBLE)
28 {return addcol(label.c_str(),tform.c_str(),tunit.c_str(),datatype);}
29 //! Add a new column to the FITS table and return its number (see addcol).
30 inline int AddCol(const char* label,const char* tform=""
31 ,const char* tunit="",int datatype=TDOUBLE)
32 {return addcol(label,tform,tunit,datatype);}
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 = (unsigned short) lp;}
40
41 void Write(int col,long row,short val);
42 void Write(int col,long row,int_4 val);
43 void Write(int col,long row,float val);
44 void Write(int col,long row,double val);
45 long Write(int col,long row,TVector<int_4>& val);
46 long Write(int col,long row,TVector<float>& val);
47 long Write(int col,long row,TVector<double>& val);
48 //! Return the number of overflows managed by cfitsio
49 inline unsigned long GetNOverFlow(void) {return NOverFlow;}
50
51protected:
52 void createfits(const char *cfname,int hdutype,int lp);
53 int addcol(const char* label,const char* tform
54 ,const char* tunit,int datatype);
55 void createtbl(void);
56 void printerrorwrite(const char* type,int col,long row,int sta);
57 void printerror(int sta) const;
58
59 string FitsFN,ExtName;
60 int HduType;
61 unsigned short DbgLevel;
62 fitsfile *FitsPtr;
63 bool FirstTime;
64 vector<string> Label;
65 vector<string> TForm;
66 vector<string> TUnit;
67 unsigned long NOverFlow;
68};
69
70} // namespace SOPHYA
71#endif /* FABTWRITER_H_SEEN */
Note: See TracBrowser for help on using the repository browser.