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 () {}
};

View file

@ -12,8 +12,10 @@ class LeoLatLong
public:
LeoLatLong ();
LeoLatLong (double latitude, double longitude);
LeoLatLong (std::string label, double latitude, double longitude);
virtual ~LeoLatLong();
std::string label;
double latitude;
double longitude;
};

View file

@ -1,20 +1,4 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007, 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <ns3/trace-source-accessor.h>
#include <ns3/packet.h>

View file

@ -1,20 +1,4 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2007, 2008 University of Washington
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "ns3/log.h"
#include "ns3/queue.h"