40 #include <fors_utils.h>
45 #define DICT_LINE_LENGTH (80)
46 #define MAX_PAF_NAME_LENGTH (80)
47 #define PAF_ROOT_NAME "qc"
79 const char *name,
const char *value,
85 header_name = cpl_malloc((strlen(name) + 6) *
sizeof(
char *));
87 strcpy(header_name,
"ESO ");
88 strcat(header_name, name);
90 for (i = 0; header_name[i] !=
'\0'; i++)
91 if (header_name[i] ==
'.')
94 if (cpl_propertylist_update_string(header, header_name, value)) {
95 cpl_free(header_name);
96 cpl_error_set_where(cpl_func);
97 return cpl_error_get_code();
100 cpl_propertylist_set_comment(header, header_name, comment);
102 cpl_free(header_name);
104 return CPL_ERROR_NONE;
132 const char *name,
const char *unit,
140 allComment = cpl_malloc(81 *
sizeof(
char *));
143 snprintf(allComment, 80,
"%s [%s]", comment, unit);
145 snprintf(allComment, 80,
"%s", comment);
148 header_name = cpl_malloc((strlen(name) + 6) *
sizeof(
char *));
150 strcpy(header_name,
"ESO ");
151 strcat(header_name, name);
153 for (i = 0; header_name[i] !=
'\0'; i++)
154 if (header_name[i] ==
'.')
155 header_name[i] =
' ';
157 if (cpl_propertylist_update_double(header, header_name, value)) {
158 cpl_free(header_name);
159 cpl_error_set_where(cpl_func);
160 return cpl_error_get_code();
163 cpl_propertylist_set_comment(header, header_name, allComment);
165 cpl_free(header_name);
166 cpl_free(allComment);
168 return CPL_ERROR_NONE;
173 cpl_error_code fors_header_write_int(cpl_propertylist *header,
int value,
174 const char *name,
const char *unit,
182 allComment = cpl_malloc(81 *
sizeof(
char *));
185 snprintf(allComment, 80,
"%s [%s]", comment, unit);
187 snprintf(allComment, 80,
"%s", comment);
189 header_name = cpl_malloc((strlen(name) + 6) *
sizeof(
char *));
191 strcpy(header_name,
"ESO ");
192 strcat(header_name, name);
194 for (i = 0; header_name[i] !=
'\0'; i++)
195 if (header_name[i] ==
'.')
196 header_name[i] =
' ';
198 if (cpl_propertylist_update_int(header, header_name, value)) {
199 cpl_free(header_name);
200 cpl_error_set_where(cpl_func);
201 return cpl_error_get_code();
204 cpl_propertylist_set_comment(header, header_name, allComment);
206 cpl_free(header_name);
207 cpl_free(allComment);
209 return CPL_ERROR_NONE;
cpl_error_code fors_header_write_double(cpl_propertylist *header, double value, const char *name, const char *unit, const char *comment)
Write an integer value to the active QC1 PAF object and to a header.
cpl_error_code fors_header_write_string(cpl_propertylist *header, const char *name, const char *value, const char *comment)
Write a string value to the active QC1 PAF object and to a header.