OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ImageOptionsFileDescriptor.cpp
Go to the documentation of this file.
1 //----------------------------------------------------------------------------
2 //
3 // "Copyright Centre National d'Etudes Spatiales"
4 //
5 // License: LGPL
6 //
7 // See LICENSE.txt file in the top level directory for more details.
8 //
9 //----------------------------------------------------------------------------
10 // $Id$
11 
13 #include <ossim/base/ossimNotify.h>
14 #include <ossim/base/ossimTrace.h>
15 
16 namespace ossimplugins
17 {
18  static ossimTrace traceDebug("ImageOptionsFileDescriptor:debug");
19 
21  {
22  }
23 
25  {
26  }
27 
29  {
30  os<<"ascii_flag:"<<data._ascii_flag.c_str()<<std::endl;
31 
32  os<<"format_doc:"<<data._format_doc.c_str()<<std::endl;
33 
34  os<<"format_rev:"<<data._format_rev.c_str()<<std::endl;
35 
36  os<<"design_rev:"<<data._design_rev.c_str()<<std::endl;
37 
38  os<<"software_id:"<<data._software_id.c_str()<<std::endl;
39 
40  os<<"file_num:"<<data._file_num<<std::endl;
41 
42  os<<"file_name:"<<data._file_name.c_str()<<std::endl;
43 
44  os<<"rec_seq:"<<data._rec_seq.c_str()<<std::endl;
45 
46  os<<"seq_loc:"<<data._seq_loc<<std::endl;
47 
48  os<<"seq_len:"<<data._seq_len<<std::endl;
49 
50  os<<"rec_code:"<<data._rec_code.c_str()<<std::endl;
51 
52  os<<"code_loc:"<<data._code_loc<<std::endl;
53 
54  os<<"code_len:"<<data._code_len<<std::endl;
55 
56  os<<"rec_len:"<<data._rec_len.c_str()<<std::endl;
57 
58  os<<"rlen_loc:"<<data._rlen_loc<<std::endl;
59 
60  os<<"rlen_len:"<<data._rlen_len<<std::endl;
61 
62  os<<"n_dataset:"<<data._n_dataset<<std::endl;
63 
64  os<<"l_dataset:"<<data._l_dataset<<std::endl;
65 
66  os<<"nbit:"<<data._nbit<<std::endl;
67 
68  os<<"nsamp:"<<data._nsamp<<std::endl;
69 
70  os<<"nbyte:"<<data._nbyte<<std::endl;
71 
72  os<<"justify:"<<data._justify.c_str()<<std::endl;
73 
74  os<<"nchn:"<<data._nchn<<std::endl;
75 
76  os<<"nlin:"<<data._nlin<<std::endl;
77 
78  os<<"nleft:"<<data._nleft<<std::endl;
79 
80  os<<"ngrp:"<<data._ngrp<<std::endl;
81 
82  os<<"nright:"<<data._nright<<std::endl;
83 
84  os<<"ntop:"<<data._ntop<<std::endl;
85 
86  os<<"nbott:"<<data._nbott<<std::endl;
87 
88  os<<"intleav:"<<data._intleav.c_str()<<std::endl;
89 
90  os<<"nrec_lin:"<<data._nrec_lin<<std::endl;
91 
92  os<<"nrec_chn:"<<data._nrec_chn<<std::endl;
93 
94  os<<"n_prefix:"<<data._n_prefix<<std::endl;
95 
96  os<<"n_sar:"<<data._n_sar<<std::endl;
97 
98  os<<"n_suffix:"<<data._n_suffix<<std::endl;
99 
100  os<<"lin_loc:"<<data._lin_loc.c_str()<<std::endl;
101 
102  os<<"chn_loc:"<<data._chn_loc.c_str()<<std::endl;
103 
104  os<<"tim_loc:"<<data._tim_loc.c_str()<<std::endl;
105 
106  os<<"left_loc:"<<data._left_loc.c_str()<<std::endl;
107 
108  os<<"right_loc:"<<data._right_loc.c_str()<<std::endl;
109 
110  os<<"pad_ind:"<<data._pad_ind.c_str()<<std::endl;
111 
112  os<<"qual_loc:"<<data._qual_loc.c_str()<<std::endl;
113 
114  os<<"cali_loc:"<<data._cali_loc.c_str()<<std::endl;
115 
116  os<<"gain_loc:"<<data._gain_loc.c_str()<<std::endl;
117 
118  os<<"bias_loc:"<<data._bias_loc.c_str()<<std::endl;
119 
120  os<<"type_id:"<<data._type_id.c_str()<<std::endl;
121 
122  os<<"type_code:"<<data._type_code.c_str()<<std::endl;
123 
124  os<<"left_fill:"<<data._left_fill<<std::endl;
125 
126  os<<"right_fill:"<<data._right_fill<<std::endl;
127 
128  os<<"pix_rng:"<<data._pix_rng<<std::endl;
129 
130  return os;
131  }
132 
134  {
135  char buf[15805];
136  buf[15804] = '\0';
137 
138  is.read(buf,2);
139  buf[2] = '\0';
140  data._ascii_flag = buf;
141 
142  is.read(buf,2);
143 
144  is.read(buf,12);
145  buf[12] = '\0';
146  data._format_doc = buf;
147 
148  is.read(buf,2);
149  buf[2] = '\0';
150  data._format_rev = buf;
151 
152  is.read(buf,2);
153  buf[2] = '\0';
154  data._design_rev = buf;
155 
156  is.read(buf,12);
157  buf[12] = '\0';
158  data._software_id = buf;
159 
160  is.read(buf,4);
161  buf[4] = '\0';
162  data._file_num = atoi(buf);
163 
164  is.read(buf,16);
165  buf[16] = '\0';
166  data._file_name = buf;
167 
168  is.read(buf,4);
169  buf[4] = '\0';
170  data._rec_seq = buf;
171 
172  is.read(buf,8);
173  buf[8] = '\0';
174  data._seq_loc = atoi(buf);
175 
176  is.read(buf,4);
177  buf[4] = '\0';
178  data._seq_len = atoi(buf);
179 
180  is.read(buf,4);
181  buf[4] = '\0';
182  data._rec_code = buf;
183 
184  is.read(buf,8);
185  buf[8] = '\0';
186  data._code_loc = atoi(buf);
187 
188  is.read(buf,4);
189  buf[4] = '\0';
190  data._code_len = atoi(buf);
191 
192  is.read(buf,4);
193  buf[4] = '\0';
194  data._rec_len = buf;
195 
196  is.read(buf,8);
197  buf[8] = '\0';
198  data._rlen_loc = atoi(buf);
199 
200  is.read(buf,4);
201  buf[4] = '\0';
202  data._rlen_len = atoi(buf);
203 
204  for (int i=0;i<4;i++)
205  {
206  is.read(buf,1);
207  }
208 
209  is.read(buf,64);
210 
211  is.read(buf,6);
212  buf[6] = '\0';
213  data._n_dataset = atoi(buf);
214 
215  is.read(buf,6);
216  buf[6] = '\0';
217  data._l_dataset = atoi(buf);
218 
219  is.read(buf,24);
220 
221  is.read(buf,4);
222  buf[4] = '\0';
223  data._nbit = atoi(buf);
224 
225  is.read(buf,4);
226  buf[4] = '\0';
227  data._nsamp = atoi(buf);
228 
229  is.read(buf,4);
230  buf[4] = '\0';
231  data._nbyte = atoi(buf);
232 
233  is.read(buf,4);
234  buf[4] = '\0';
235  data._justify = buf;
236 
237  is.read(buf,4);
238  buf[4] = '\0';
239  data._nchn = atoi(buf);
240 
241  is.read(buf,8);
242  buf[8] = '\0';
243 
244  // We should use strtol() to avoid wrong conversion with atoi()
245  char* p;
246  int result = strtol(buf, &p, 10);
247  if ( *p != 0 || p == buf)
248  {
249  if(traceDebug())
250  {
251  ossimNotify(ossimNotifyLevel_DEBUG) << "WARNING: strtol() try to convert an empty tab of characters. It may be possible in case of SCN and SCW format" << buf << "!" << std::endl;
252  ossimNotify(ossimNotifyLevel_DEBUG) << "=> _nlin = -1" << std::endl;
253  }
254  data._nlin = -1;
255  }
256  else
257  {
258  data._nlin = result;
259  };
260 
261  is.read(buf,4);
262  buf[4] = '\0';
263  data._nleft = atoi(buf);
264 
265  is.read(buf,8);
266  buf[8] = '\0';
267  data._ngrp = atoi(buf);
268 
269  is.read(buf,4);
270  buf[4] = '\0';
271  data._nright = atoi(buf);
272 
273  is.read(buf,4);
274  buf[4] = '\0';
275  data._ntop = atoi(buf);
276 
277  is.read(buf,4);
278  buf[4] = '\0';
279  data._nbott = atoi(buf);
280 
281  is.read(buf,4);
282  buf[4] = '\0';
283  data._intleav = buf;
284 
285  is.read(buf,2);
286  buf[2] = '\0';
287  data._nrec_lin = atoi(buf);
288 
289  is.read(buf,2);
290  buf[2] = '\0';
291  data._nrec_chn = atoi(buf);
292 
293  is.read(buf,4);
294  buf[4] = '\0';
295  data._n_prefix = atoi(buf);
296 
297  is.read(buf,8);
298  buf[8] = '\0';
299  data._n_sar = atoi(buf);
300 
301  is.read(buf,4);
302  buf[4] = '\0';
303  data._n_suffix = atoi(buf);
304 
305  is.read(buf,4);
306 
307  is.read(buf,8);
308  buf[8] = '\0';
309  data._lin_loc = buf;
310 
311  is.read(buf,8);
312  buf[8] = '\0';
313  data._chn_loc = buf;
314 
315  is.read(buf,8);
316  buf[8] = '\0';
317  data._tim_loc = buf;
318 
319  is.read(buf,8);
320  buf[8] = '\0';
321  data._left_loc = buf;
322 
323  is.read(buf,8);
324  buf[8] = '\0';
325  data._right_loc = buf;
326 
327  is.read(buf,4);
328  buf[4] = '\0';
329  data._pad_ind = buf;
330 
331  is.read(buf,28);
332 
333  is.read(buf,8);
334  buf[8] = '\0';
335  data._qual_loc = buf;
336 
337  is.read(buf,8);
338  buf[8] = '\0';
339  data._cali_loc = buf;
340 
341  is.read(buf,8);
342  buf[8] = '\0';
343  data._gain_loc = buf;
344 
345  is.read(buf,8);
346  buf[8] = '\0';
347  data._bias_loc = buf;
348 
349  is.read(buf,28);
350  buf[28] = '\0';
351  data._type_id = buf;
352 
353  is.read(buf,4);
354  buf[4] = '\0';
355  data._type_code = buf;
356 
357  is.read(buf,4);
358  buf[4] = '\0';
359  data._left_fill = atoi(buf);
360 
361  is.read(buf,4);
362  buf[4] = '\0';
363  data._right_fill = atoi(buf);
364 
365  is.read(buf,8);
366  buf[8] = '\0';
367  data._pix_rng = atoi(buf);
368 
369  is.read(buf,15804);
370 
371  return is;
372  }
373 
375  RadarSatRecord(rhs)
376  {
377 
378 
379  }
380 
382  {
383  return *this;
384  }
385 }
std::string _rec_len
Record length/location flag
int _nrec_lin
Number of physical records per line
ImageOptionsFileDescriptor & operator=(const ImageOptionsFileDescriptor &rhs)
Copy operator.
int _n_sar
Number of bytes of SAR data (or pixel data) per record
std::string _justify
Sample justification and order
int _n_suffix
Number of bytes of suffix data per record
This class is the base class of all the record classes.
std::string _design_rev
File design revision
std::string _rec_code
Record code/location flag
std::ostream & operator<<(std::ostream &os, const AlosPalsarData &data)
std::string _rec_seq
Record sequence/location flag
std::istream & operator>>(std::istream &is, AlosPalsarData &data)
std::string _format_doc
Format control document
This class is able to read an Image options file descriptor record.
std::string _cali_loc
Calibration info locator
std::basic_istream< char > istream
Base class for char input streams.
Definition: ossimIosFwd.h:20
int _n_prefix
Number of bytes of prefix data per record
std::string _chn_loc
Channel number locator
int _nrec_chn
Number of physical records per multi-channel line in this file
std::string _format_rev
Format document revision
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23