50 const string AntexHeader::versionString =
"ANTEX VERSION / SYST";
51 const string AntexHeader::pcvTypeString =
"PCV TYPE / REFANT";
52 const string AntexHeader::headerCommentString =
"COMMENT";
53 const string AntexHeader::endOfHeaderString =
"END OF HEADER";
55 void AntexHeader::reallyPutRecord(
FFStream& ffs)
const
61 unsigned long allValid;
64 allValid = allValid13;
69 err.addText(
"Make sure to set the version correctly.");
73 if ((
valid & allValid) != allValid)
75 FFStreamError
err(
"Incomplete or invalid header.");
77 "Set all header valid bits for all of the available data.");
83 WriteHeaderRecords(strm);
85 catch (FFStreamError& e)
89 catch (StringException& e)
97 void AntexHeader::WriteHeaderRecords(
FFStream& ffs)
const
102 if ((
valid & versionValid) | systemValid)
105 line += string(12,
' ');
108 line += versionString;
112 if (
valid & pcvTypeValid)
115 line += string(19,
' ');
118 line += pcvTypeString;
122 if (
valid & commentValid)
124 vector<string>::const_iterator itr = commentList.begin();
125 while (itr != commentList.end())
128 line += headerCommentString;
134 if (
valid & endValid)
136 line = string(60,
' ');
137 line += endOfHeaderString;
144 void AntexHeader::ParseHeaderRecord(
string& line)
146 string label(line, 60, 20);
148 if (label == versionString)
152 if (system !=
' ' && system !=
'G' && system !=
'R' && system !=
'E' &&
153 system !=
'C' && system !=
'M')
157 FFStreamError e(
"Satellite system is invalid: " + os.str());
160 valid |= versionValid;
161 valid |= systemValid;
163 else if (label == pcvTypeString)
166 if (pcvType !=
'A' && pcvType !=
'R')
170 FFStreamError e(
"PCV type is invalid: " + os.str());
173 refAntType = line.substr(20, 20);
174 refAntSerNum = line.substr(40, 20);
175 valid |= pcvTypeValid;
177 else if (label == headerCommentString)
180 valid |= commentValid;
182 else if (label == endOfHeaderString)
188 FFStreamError e(
"Unidentified label: " + label);
213 while (!(
valid & endValid))
218 if (line.length() == 0)
222 else if (line.length() < 60 || line.length() > 80)
224 FFStreamError e(
"Invalid line length");
230 ParseHeaderRecord(line);
232 catch (FFStreamError& e)
239 unsigned long allValid;
242 allValid = allValid13;
246 FFStreamError e(
"Unknown or unsupported Antex version " +
251 if ((allValid &
valid) != allValid)
253 FFStreamError e(
"Incomplete or invalid header");
265 s <<
"Dump of AntexHeader, version " << fixed << setprecision(1)
266 <<
version <<
" system " << system << endl;
267 s <<
"These are " << (pcvType ==
'A' ?
"absolute" :
"relative")
268 <<
" phase center offsets.\n";
269 s <<
"Reference antenna: type " << refAntType <<
", serial no. "
270 << refAntSerNum << endl;
272 for (
size_t i = 0; i < commentList.size(); i++)
278 s <<
"Comment " << setw(2) << i + 1 <<
": " << commentList[i] << endl;
280 s <<
"End of AntexHeader dump" << endl;