This commit is contained in:
Tim Schubert 2020-08-26 20:55:59 +02:00
parent f7bd15f1a8
commit 8d5cbfe8fe
9 changed files with 50 additions and 99 deletions

View file

@ -6,15 +6,16 @@ namespace ns3 {
std::ostream &operator << (std::ostream &os, const LeoLatLong &l)
{
os << l.latitude << ":" << l.longitude;
os << l.label << "," << l.latitude << "," << l.longitude;
return os;
}
std::istream &operator >> (std::istream &is, LeoLatLong &l)
{
char c1;
is >> l.latitude >> c1 >> l.longitude;
if (c1 != ':')
char c1, c2;
is >> l.label >> c1 >> l.latitude >> c2 >> l.longitude;
if (c1 != ',' ||
c2 != ',')
{
is.setstate (std::ios_base::failbit);
}
@ -23,6 +24,7 @@ std::istream &operator >> (std::istream &is, LeoLatLong &l)
LeoLatLong::LeoLatLong () : latitude (0), longitude (0) {}
LeoLatLong::LeoLatLong (double la, double lo) : latitude (la), longitude (lo) {}
LeoLatLong::LeoLatLong (std::string label, double la, double lo) : latitude (la), longitude (lo) {}
LeoLatLong::~LeoLatLong () {}
};