Main Page
Related Pages
API Reference
Namespace List
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
g
i
n
o
p
r
s
t
v
w
x
z
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
v
w
x
y
z
Class List
Class List
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
v
z
Enumerations
b
c
e
f
g
h
k
o
p
r
s
t
v
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Related Functions
:
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
Variables
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
Enumerations
Enumerator
Macros
_
a
c
d
f
g
h
i
l
m
n
o
p
r
s
t
v
x
Examples
core
lib
FileHandling
SEM
SEMHeader.cpp
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4
//
5
// The GNSSTk is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published
7
// by the Free Software Foundation; either version 3.0 of the License, or
8
// any later version.
9
//
10
// The GNSSTk is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with GNSSTk; if not, write to the Free Software Foundation,
17
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18
//
19
// This software was developed by Applied Research Laboratories at the
20
// University of Texas at Austin.
21
// Copyright 2004-2022, The Board of Regents of The University of Texas System
22
//
23
//==============================================================================
24
25
//==============================================================================
26
//
27
// This software was developed by Applied Research Laboratories at the
28
// University of Texas at Austin, under contract to an agency or agencies
29
// within the U.S. Department of Defense. The U.S. Government retains all
30
// rights to use, duplicate, distribute, disclose, or release this software.
31
//
32
// Pursuant to DoD Directive 523024
33
//
34
// DISTRIBUTION STATEMENT A: This software has been approved for public
35
// release, distribution is unlimited.
36
//
37
//==============================================================================
38
44
#include "
StringUtils.hpp
"
45
#include "
GNSSconstants.hpp
"
46
47
#include "
SEMHeader.hpp
"
48
#include "
SEMStream.hpp
"
49
50
51
using namespace
gnsstk::StringUtils
;
52
using namespace
std
;
53
54
namespace
gnsstk
55
{
56
short
SEMHeader::nearFullWeek
= 0;
57
58
void
SEMHeader::reallyPutRecord
(
FFStream
& ffs)
const
59
{
60
string
line;
61
62
SEMStream
& strm =
dynamic_cast<
SEMStream
&
>
(ffs);
63
64
line =
leftJustify
(asString<short>(numRecords),2);
65
line +=
" "
;
66
line +=
Title
;
67
strm << line << endl;
68
line.erase();
69
70
line =
rightJustify
(asString<short>(week),4);
71
line +=
" "
;
72
line += asString<long>(Toa);
73
strm << line << endl;
74
line.erase();
75
76
}
// end SEMAHeader::reallyPutRecord
77
78
79
void
SEMHeader::reallyGetRecord
(
FFStream
& ffs)
80
{
81
string
line;
82
83
SEMStream
& strm =
dynamic_cast<
SEMStream
&
>
(ffs);
84
85
//Grab the first line
86
strm.
formattedGetLine
(line);
87
if
(line.find_first_not_of(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_ .-+"
) != std::string::npos ||
88
line.length() < 4 || line.length() > 28)
89
{
90
FFStreamError fe(
"Invalid data"
);
91
GNSSTK_THROW
(fe);
92
}
93
94
numRecords = (short)
asInt
(line.substr(0,2));
95
Title
= line.substr(3,24);
96
97
//Grab the second line
98
strm.
formattedGetLine
(line);
99
if
(line.find_first_not_of(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_ .-+"
) != std::string::npos ||
100
line.length() < 6 || line.length() > 12)
101
{
102
FFStreamError fe(
"Invalid data"
);
103
GNSSTK_THROW
(fe);
104
}
105
vector<std::string> values =
split
(line,
' '
);
106
if
(values.size()!=2)
107
{
108
FFStreamError fe(
"Invalid data"
);
109
GNSSTK_THROW
(fe);
110
}
111
week = (short)
asInt
(values[0]);
112
Toa =
asInt
(values[1]);
113
114
if
(nearFullWeek > 0)
115
{
116
// In case a full week is provided.
117
week %= 1024;
118
week += (nearFullWeek / 1024) * 1024;
119
short
diff = nearFullWeek - week;
120
if
(diff > 512)
121
week += 512;
122
else
if
(diff < -512)
123
week -= 512;
124
}
125
126
strm.
header
= *
this
;
127
strm.
headerRead
=
true
;
128
129
}
// end of reallyGetRecord()
130
131
void
SEMHeader::dump
(ostream& s)
const
132
{
133
std::cout <<
"numRecords = "
<< numRecords << std::endl;
134
std::cout <<
"Title = "
<<
Title
<< std::endl;
135
std::cout <<
"week = "
<< week << std::endl;
136
std::cout <<
"Toa = "
<< Toa << std::endl;
137
}
138
139
}
// namespace
gnsstk::StringUtils::asInt
long asInt(const std::string &s)
Definition:
StringUtils.hpp:713
gnsstk::FFStream
Definition:
FFStream.hpp:119
StringUtils.hpp
gnsstk::FFTextStream::formattedGetLine
void formattedGetLine(std::string &line, const bool expectEOF=false)
Definition:
FFTextStream.cpp:149
gnsstk::SEMStream
Definition:
SEMStream.hpp:68
SEMHeader.hpp
GNSSconstants.hpp
gnsstk
For Sinex::InputHistory.
Definition:
BasicFramework.cpp:50
gnsstk::StringUtils::split
std::vector< std::string > split(const std::string &str, const char delimiter=' ')
Definition:
StringUtils.hpp:2275
Title
string Title
Definition:
testSSEph.cpp:86
gnsstk::SEMHeader::dump
virtual void dump(std::ostream &s) const
Definition:
SEMHeader.cpp:131
gnsstk::SEMStream::headerRead
bool headerRead
Flag showing whether or not the header has been read.
Definition:
SEMStream.hpp:99
gnsstk::SEMHeader::nearFullWeek
static GNSSTK_EXPORT short nearFullWeek
Definition:
SEMHeader.hpp:85
gnsstk::StringUtils
Definition:
IonexStoreStrategy.cpp:44
gnsstk::StringUtils::rightJustify
std::string & rightJustify(std::string &s, const std::string::size_type length, const char pad=' ')
Definition:
StringUtils.hpp:1557
std
Definition:
Angle.hpp:142
SEMStream.hpp
gnsstk::StringUtils::leftJustify
std::string & leftJustify(std::string &s, const std::string::size_type length, const char pad=' ')
Definition:
StringUtils.hpp:1582
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition:
Exception.hpp:366
gnsstk::SEMHeader::reallyPutRecord
virtual void reallyPutRecord(FFStream &s) const
Definition:
SEMHeader.cpp:58
gnsstk::SEMHeader::reallyGetRecord
virtual void reallyGetRecord(FFStream &s)
Definition:
SEMHeader.cpp:79
gnsstk::SEMStream::header
SEMHeader header
SEMHeader for this file.
Definition:
SEMStream.hpp:96
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41