ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbFITS.hpp
Go to the documentation of this file.
1
8#ifndef ngcbFITS_H
9#define ngcbFITS_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <ngc/core/ngcb.h>
17#include <ngc/core/ngcbDIC.hpp>
18
20extern int ngcbDetIndex;
21
25class ngcbFITS {
26public:
28 ngcbFITS();
29
31 explicit ngcbFITS(int n);
32
34 virtual ~ngcbFITS();
35
38
40 int NumBlock(int n);
41
43 int NumBlock();
44
46 char *Header() {return (header_);}
47
49 int HeaderSize() {return (headerSize_);}
50
52 void HeaderSize(int s) {headerSize_=s;}
53
55 void HeaderInit();
56
58 void HeaderEnd();
59
61 int GetKey(const char *fitsLine, char *keyword, char *value = NULL);
62
64 int Full() {return ((headerSize_ + ngcbFITS_LINE_LEN + 1) > allocSize_);}
65
67 int Read(const char *keyword, int *offset, char *value = NULL);
68
70 int Write(const char *fitsLine);
71
73 int Append(const char *fitsLine);
74
76 int Add(const char *keyword, int var, const char *comment = NULL);
77
79 int Add(const char *keyword, float var, const char *comment = NULL);
80
82 int Add(const char *keyword, double var, const char *comment = NULL);
83
85 int Add(const char *keyword, const char *var, const char *comment = NULL);
86
88 int AddLongString(const char *keyword, const char *var,
89 const char *comment = NULL);
90
92 int Add(const char *comment);
93
95 int AddLogical(const char *keyword, int var, const char *comment = NULL);
96
98 int AddFree(const char *keyword, const char *var,
99 const char *comment = NULL);
100
102 int Merge(const char *keyword, int var, const char *comment = NULL);
103
105 int Merge(const char *keyword, float var, const char *comment = NULL);
106
108 int Merge(const char *keyword, double var, const char *comment = NULL);
109
111 int Merge(const char *keyword, const char *var, const char *comment = NULL);
112
114 int Merge(const char *keyword, const char *comment = NULL);
115
117 int MergeFree(const char *keyword, const char *var,
118 const char *comment = NULL);
119
121 int Merge(ngcbFITS *object);
122
124 void AttachDictionary(ngcbDIC *dic);
125
127 void DetachDictionary();
128
130 char *ErrMsg() {return (erms_);}
131
132protected:
133
134private:
136 void Init_();
137
139 char erms_[256];
140
142 char *header_;
143
145 int headerSize_;
146
148 int allocSize_;
149
151 int numBlock_;
152
154 ngcbDIC *dictionary_;
155
157 int Gen_(char *fitsLine, const char *keyword, int type, int intVal,
158 double doubleVal, const char *stringVal, const char *comment);
159
161 int GenKey_(char *fitsLine, const char *keyword, char *comment);
162
164 int Combine_(const char *newHeader, int newSize);
165
167 int Read_(const char *keyword, int len, int *offset, char *value);
168
169};
170
171#endif
Definition ngcbDIC.hpp:51
Definition ngcbFITS.hpp:25
int Merge(const char *keyword, int var, const char *comment=NULL)
Merge 32-bit integer keyword (overwrite if existing)
Definition ngcbFITS.cpp:452
void DetachDictionary()
Detach dictionary.
Definition ngcbFITS.cpp:75
int Add(const char *keyword, int var, const char *comment=NULL)
Add 32-bit integer keyword.
Definition ngcbFITS.cpp:147
void AttachDictionary(ngcbDIC *dic)
Attach dictionary.
Definition ngcbFITS.cpp:73
int Append(const char *fitsLine)
Append a line to the header.
Definition ngcbFITS.cpp:785
void HeaderEnd()
Finish header (padding etc.)
Definition ngcbFITS.cpp:116
int AddLogical(const char *keyword, int var, const char *comment=NULL)
Add logical keyword.
Definition ngcbFITS.cpp:161
int GetKey(const char *fitsLine, char *keyword, char *value=NULL)
Get keyword and value from line.
Definition ngcbFITS.cpp:601
virtual ~ngcbFITS()
Destructor.
Definition ngcbFITS.cpp:50
int HeaderSize()
Current header size.
Definition ngcbFITS.hpp:49
int Read(const char *keyword, int *offset, char *value=NULL)
Read keyword and value from header.
Definition ngcbFITS.cpp:738
ngcbFITS()
Constructor.
Definition ngcbFITS.cpp:34
int Write(const char *fitsLine)
(Re-)Write a line in the header
Definition ngcbFITS.cpp:743
char * Header()
Current header.
Definition ngcbFITS.hpp:46
char padBlock[ngcbFITS_BLOCK_LEN]
Constant block for padding.
Definition ngcbFITS.hpp:37
char * ErrMsg()
Error message.
Definition ngcbFITS.hpp:130
int MergeFree(const char *keyword, const char *var, const char *comment=NULL)
Merge free generic keyword (overwrite if existing)
Definition ngcbFITS.cpp:538
int AddFree(const char *keyword, const char *var, const char *comment=NULL)
Add free generic keyword.
Definition ngcbFITS.cpp:400
int AddLongString(const char *keyword, const char *var, const char *comment=NULL)
Add long string keyword.
Definition ngcbFITS.cpp:240
void HeaderSize(int s)
Import header size.
Definition ngcbFITS.hpp:52
int NumBlock()
Actual number of reserved blocks.
Definition ngcbFITS.cpp:108
void HeaderInit()
(Re-)initialize header
Definition ngcbFITS.cpp:110
int Full()
Check if header is full.
Definition ngcbFITS.hpp:64
int ngcbDetIndex
Detector system index (global per application)
Definition ngcbFITS.cpp:29
#define ngcbFITS_LINE_LEN
Definition ngcb.h:176
#define ngcbFITS_BLOCK_LEN
Definition ngcb.h:191