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

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

possibilite d'ecrire directement des TVector fabtwriter cmv 27/9/01

File size: 2.4 KB
RevLine 
[1654]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
[1657]39 inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
[1654]40
[1657]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);
[1654]44 void Write(int col,long row,double val);
[1657]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);
[1654]48 //! Return the number of overflows managed by cfitsio
[1657]49 inline unsigned long GetNOverFlow(void) {return NOverFlow;}
[1654]50
51protected:
52 void createfits(const char *cfname,int hdutype,int lp);
53 int addcol(const char* label,int datatype
54 ,const char* tform,const char* tunit);
55 void createtbl(void);
56 void printerrorwrite(char* type,int col,long row,int sta);
57 void printerror(int sta) const;
58
59 string FitsFN,ExtName;
60 int HduType;
[1657]61 unsigned short DbgLevel;
[1654]62 fitsfile *FitsPtr;
63 bool FirstTime;
64 vector<string> Label;
65 vector<int> DataType;
66 vector<string> TForm;
67 vector<string> TUnit;
[1657]68 unsigned long NOverFlow;
[1654]69};
70
71} // namespace SOPHYA
72#endif /* FABTWRITER_H_SEEN */
Note: See TracBrowser for help on using the repository browser.