ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcbFITS.hpp
Go to the documentation of this file.
1
7#ifndef ngcbFITS_H
8#define ngcbFITS_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcb.h>
16#include <ngc/core/ngcbDIC.hpp>
17
19extern int ngcbDetIndex;
20
24class ngcbFITS {
25public:
27 ngcbFITS();
28
30 explicit ngcbFITS(int n);
31
33 virtual ~ngcbFITS();
34
37
39 int NumBlock(int n);
40
42 int NumBlock();
43
45 char *Header() {return (header_);}
46
48 int HeaderSize() {return (headerSize_);}
49
51 void HeaderSize(int s) {headerSize_=s;}
52
54 void HeaderInit();
55
57 void HeaderEnd();
58
60 int GetKey(const char *fitsLine, char *keyword, char *value = NULL);
61
63 int Full() {return ((headerSize_ + ngcbFITS_LINE_LEN + 1) > allocSize_);}
64
66 int Read(const char *keyword, int *offset, char *value = NULL);
67
69 int Write(const char *fitsLine);
70
72 int Append(const char *fitsLine);
73
75 int Add(const char *keyword, int var, const char *comment = NULL);
76
78 int Add(const char *keyword, float var, const char *comment = NULL);
79
81 int Add(const char *keyword, double var, const char *comment = NULL);
82
84 int Add(const char *keyword, const char *var, const char *comment = NULL);
85
87 int AddLongString(const char *keyword, const char *var,
88 const char *comment = NULL);
89
91 int Add(const char *comment);
92
94 int AddLogical(const char *keyword, int var, const char *comment = NULL);
95
97 int AddFree(const char *keyword, const char *var,
98 const char *comment = NULL);
99
101 int Merge(const char *keyword, int var, const char *comment = NULL);
102
104 int Merge(const char *keyword, float var, const char *comment = NULL);
105
107 int Merge(const char *keyword, double var, const char *comment = NULL);
108
110 int Merge(const char *keyword, const char *var, const char *comment = NULL);
111
113 int Merge(const char *keyword, const char *comment = NULL);
114
116 int MergeFree(const char *keyword, const char *var,
117 const char *comment = NULL);
118
120 int Merge(ngcbFITS *object);
121
123 void AttachDictionary(ngcbDIC *dic);
124
126 void DetachDictionary();
127
129 char *ErrMsg() {return (erms_);}
130
131protected:
132
133private:
135 void Init_();
136
138 char erms_[256];
139
141 char *header_;
142
144 int headerSize_;
145
147 int allocSize_;
148
150 int numBlock_;
151
153 ngcbDIC *dictionary_;
154
156 int Gen_(char *fitsLine, const char *keyword, int type, int intVal,
157 double doubleVal, const char *stringVal, const char *comment);
158
160 int GenKey_(char *fitsLine, const char *keyword, char *comment);
161
163 int Combine_(const char *newHeader, int newSize);
164
166 int Read_(const char *keyword, int len, int *offset, char *value);
167
168};
169
170#endif
Definition ngcbDIC.hpp:50
Definition ngcbFITS.hpp:24
int Merge(const char *keyword, int var, const char *comment=NULL)
Merge 32-bit integer keyword (overwrite if existing)
Definition ngcbFITS.cpp:451
void DetachDictionary()
Detach dictionary.
Definition ngcbFITS.cpp:74
int Add(const char *keyword, int var, const char *comment=NULL)
Add 32-bit integer keyword.
Definition ngcbFITS.cpp:146
void AttachDictionary(ngcbDIC *dic)
Attach dictionary.
Definition ngcbFITS.cpp:72
int Append(const char *fitsLine)
Append a line to the header.
Definition ngcbFITS.cpp:784
void HeaderEnd()
Finish header (padding etc.)
Definition ngcbFITS.cpp:115
int AddLogical(const char *keyword, int var, const char *comment=NULL)
Add logical keyword.
Definition ngcbFITS.cpp:160
int GetKey(const char *fitsLine, char *keyword, char *value=NULL)
Get keyword and value from line.
Definition ngcbFITS.cpp:600
virtual ~ngcbFITS()
Destructor.
Definition ngcbFITS.cpp:49
int HeaderSize()
Current header size.
Definition ngcbFITS.hpp:48
int Read(const char *keyword, int *offset, char *value=NULL)
Read keyword and value from header.
Definition ngcbFITS.cpp:737
ngcbFITS()
Constructor.
Definition ngcbFITS.cpp:33
int Write(const char *fitsLine)
(Re-)Write a line in the header
Definition ngcbFITS.cpp:742
char * Header()
Current header.
Definition ngcbFITS.hpp:45
char padBlock[ngcbFITS_BLOCK_LEN]
Constant block for padding.
Definition ngcbFITS.hpp:36
char * ErrMsg()
Error message.
Definition ngcbFITS.hpp:129
int MergeFree(const char *keyword, const char *var, const char *comment=NULL)
Merge free generic keyword (overwrite if existing)
Definition ngcbFITS.cpp:537
int AddFree(const char *keyword, const char *var, const char *comment=NULL)
Add free generic keyword.
Definition ngcbFITS.cpp:399
int AddLongString(const char *keyword, const char *var, const char *comment=NULL)
Add long string keyword.
Definition ngcbFITS.cpp:239
void HeaderSize(int s)
Import header size.
Definition ngcbFITS.hpp:51
int NumBlock()
Actual number of reserved blocks.
Definition ngcbFITS.cpp:107
void HeaderInit()
(Re-)initialize header
Definition ngcbFITS.cpp:109
int Full()
Check if header is full.
Definition ngcbFITS.hpp:63
int ngcbDetIndex
Detector system index (global per application)
Definition ngcbFITS.cpp:28
#define ngcbFITS_LINE_LEN
Definition ngcb.h:175
#define ngcbFITS_BLOCK_LEN
Definition ngcb.h:190