Create command line options for orbit trace

This commit is contained in:
Tim Schubert 2020-08-23 19:37:40 +02:00
parent f214b48dbf
commit b7f459e36a
10 changed files with 266 additions and 97 deletions

29
model/leo-orbit.cc Normal file
View file

@ -0,0 +1,29 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "leo-orbit.h"
namespace ns3 {
std::ostream &operator << (std::ostream &os, const LeoOrbit &orbit)
{
os << orbit.alt << ":" << orbit.inc << ":" << orbit.planes << ":" << orbit.sats;
return os;
}
std::istream &operator >> (std::istream &is, LeoOrbit &orbit)
{
char c1, c2, c3;
is >> orbit.alt >> c1 >> orbit.inc >> c2 >> orbit.planes >> c3 >> orbit.sats;
if (c1 != ':' ||
c2 != ':' ||
c3 != ':')
{
is.setstate (std::ios_base::failbit);
}
return is;
}
LeoOrbit::LeoOrbit () : alt (0), inc (0), planes (0), sats (0) {}
LeoOrbit::~LeoOrbit () {}
};

28
model/leo-orbit.h Normal file
View file

@ -0,0 +1,28 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#ifndef LEO_ORBIT_H
#define LEO_ORBIT_H
#include "ns3/uinteger.h"
namespace ns3
{
class LeoOrbit;
std::ostream &operator << (std::ostream &os, const LeoOrbit &orbit);
std::istream &operator >> (std::istream &is, LeoOrbit &orbit);
class LeoOrbit {
public:
LeoOrbit ();
LeoOrbit (double a, double i, double p, double s) : alt (a), inc (i), planes (p), sats (s) {}
virtual ~LeoOrbit ();
double alt;
double inc;
uint16_t planes;
uint16_t sats;
};
};
#endif