Misc c++ updates
parent
16f4717840
commit
1a57bb43f9
|
@ -0,0 +1 @@
|
|||
build/
|
|
@ -5,7 +5,11 @@ if (POLICY CMP0054)
|
|||
cmake_policy(SET CMP0054 NEW)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "..." FORCE)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
|
|
|
@ -38,4 +38,4 @@ set(SRCS
|
|||
add_library(sgp4 STATIC ${SRCS} ${INCS})
|
||||
add_library(sgp4s SHARED ${SRCS} ${INCS})
|
||||
install( TARGETS sgp4s LIBRARY DESTINATION lib )
|
||||
install( FILES ${INCS} DESTINATION include/SGP4 )
|
||||
install( FILES ${INCS} DESTINATION include/libsgp4 )
|
||||
|
|
|
@ -37,12 +37,7 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
CoordGeodetic()
|
||||
: latitude(0.0),
|
||||
longitude(0.0),
|
||||
altitude(0.0)
|
||||
{
|
||||
}
|
||||
CoordGeodetic() = default;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -111,11 +106,11 @@ public:
|
|||
}
|
||||
|
||||
/** latitude in radians (-PI >= latitude < PI) */
|
||||
double latitude;
|
||||
double latitude{};
|
||||
/** latitude in radians (-PI/2 >= latitude <= PI/2) */
|
||||
double longitude;
|
||||
double longitude{};
|
||||
/** altitude in kilometers */
|
||||
double altitude;
|
||||
double altitude{};
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,13 +39,7 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
CoordTopocentric()
|
||||
: azimuth(0.0)
|
||||
, elevation(0.0)
|
||||
, range(0.0)
|
||||
, range_rate(0.0)
|
||||
{
|
||||
}
|
||||
CoordTopocentric() = default;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -110,13 +104,13 @@ public:
|
|||
}
|
||||
|
||||
/** azimuth in radians */
|
||||
double azimuth;
|
||||
double azimuth{};
|
||||
/** elevations in radians */
|
||||
double elevation;
|
||||
double elevation{};
|
||||
/** range in kilometers */
|
||||
double range;
|
||||
double range{};
|
||||
/** range rate in kilometers per second */
|
||||
double range_rate;
|
||||
double range_rate{};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
* Constructor
|
||||
* @param[in] ticks raw tick value
|
||||
*/
|
||||
DateTime(int64_t ticks)
|
||||
explicit DateTime(int64_t ticks)
|
||||
: m_encoded(ticks)
|
||||
{
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ public:
|
|||
|
||||
DateTime AddMicroseconds(const double microseconds) const
|
||||
{
|
||||
int64_t ticks = static_cast<int64_t>(microseconds * TicksPerMicrosecond);
|
||||
auto ticks = static_cast<int64_t>(microseconds * TicksPerMicrosecond);
|
||||
return AddTicks(ticks);
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ public:
|
|||
*/
|
||||
double ToJulian() const
|
||||
{
|
||||
TimeSpan ts = TimeSpan(Ticks());
|
||||
auto ts = TimeSpan(Ticks());
|
||||
return ts.TotalDays() + 1721425.5;
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
int64_t m_encoded;
|
||||
int64_t m_encoded{};
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& strm, const DateTime& dt)
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
* Constructor
|
||||
* @param[in] geo the observers position
|
||||
*/
|
||||
Observer(const CoordGeodetic &geo)
|
||||
explicit Observer(const CoordGeodetic &geo)
|
||||
: m_geo(geo)
|
||||
, m_eci(DateTime(), geo)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ class Tle;
|
|||
class OrbitalElements
|
||||
{
|
||||
public:
|
||||
OrbitalElements(const Tle& tle);
|
||||
explicit OrbitalElements(const Tle& tle);
|
||||
|
||||
/*
|
||||
* XMO
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace libsgp4
|
|||
class SGP4
|
||||
{
|
||||
public:
|
||||
SGP4(const Tle& tle)
|
||||
explicit SGP4(const Tle& tle)
|
||||
: elements_(tle)
|
||||
{
|
||||
Initialise();
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace libsgp4
|
|||
class SatelliteException : public std::runtime_error
|
||||
{
|
||||
public:
|
||||
SatelliteException(const char* message)
|
||||
explicit SatelliteException(const char* message)
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -29,9 +29,7 @@ namespace libsgp4
|
|||
class SolarPosition
|
||||
{
|
||||
public:
|
||||
SolarPosition()
|
||||
{
|
||||
}
|
||||
SolarPosition() = default;
|
||||
|
||||
Eci FindPosition(const DateTime& dt);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace libsgp4
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ namespace
|
|||
class TimeSpan
|
||||
{
|
||||
public:
|
||||
TimeSpan(int64_t ticks)
|
||||
explicit TimeSpan(int64_t ticks)
|
||||
: m_ticks(ticks)
|
||||
{
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
int64_t m_ticks;
|
||||
int64_t m_ticks{};
|
||||
|
||||
void CalculateTicks(int days,
|
||||
int hours,
|
||||
|
|
|
@ -146,9 +146,13 @@ void Tle::Initialize()
|
|||
TLE2_LEN_REVATEPOCH), orbit_number_);
|
||||
|
||||
if (year < 57)
|
||||
{
|
||||
year += 2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
year += 1900;
|
||||
}
|
||||
|
||||
epoch_ = DateTime(year, day);
|
||||
}
|
||||
|
@ -174,18 +178,18 @@ void Tle::ExtractInteger(const std::string& str, unsigned int& val)
|
|||
bool found_digit = false;
|
||||
unsigned int temp = 0;
|
||||
|
||||
for (std::string::const_iterator i = str.begin(); i != str.end(); ++i)
|
||||
for (auto& i : str)
|
||||
{
|
||||
if (isdigit(*i))
|
||||
if (isdigit(i))
|
||||
{
|
||||
found_digit = true;
|
||||
temp = (temp * 10) + static_cast<unsigned int>(*i - '0');
|
||||
temp = (temp * 10) + static_cast<unsigned int>(i - '0');
|
||||
}
|
||||
else if (found_digit)
|
||||
{
|
||||
throw TleException("Unexpected non digit");
|
||||
}
|
||||
else if (*i != ' ')
|
||||
else if (i != ' ')
|
||||
{
|
||||
throw TleException("Invalid character");
|
||||
}
|
||||
|
|
|
@ -37,10 +37,9 @@ public:
|
|||
* @param[in] line_one Tle line one
|
||||
* @param[in] line_two Tle line two
|
||||
*/
|
||||
Tle(const std::string& line_one,
|
||||
const std::string& line_two)
|
||||
: line_one_(line_one)
|
||||
, line_two_(line_two)
|
||||
Tle(std::string line_one, std::string line_two)
|
||||
: line_one_(std::move(line_one))
|
||||
, line_two_(std::move(line_two))
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -51,12 +50,10 @@ public:
|
|||
* @param[in] line_one Tle line one
|
||||
* @param[in] line_two Tle line two
|
||||
*/
|
||||
Tle(const std::string& name,
|
||||
const std::string& line_one,
|
||||
const std::string& line_two)
|
||||
: name_(name)
|
||||
, line_one_(line_one)
|
||||
, line_two_(line_two)
|
||||
Tle(std::string name, std::string line_one, std::string line_two)
|
||||
: name_(std::move(name))
|
||||
, line_one_(std::move(line_one))
|
||||
, line_two_(std::move(line_two))
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
@ -319,17 +316,17 @@ private:
|
|||
|
||||
std::string int_designator_;
|
||||
DateTime epoch_;
|
||||
double mean_motion_dt2_;
|
||||
double mean_motion_ddt6_;
|
||||
double bstar_;
|
||||
double inclination_;
|
||||
double right_ascending_node_;
|
||||
double eccentricity_;
|
||||
double argument_perigee_;
|
||||
double mean_anomaly_;
|
||||
double mean_motion_;
|
||||
unsigned int norad_number_;
|
||||
unsigned int orbit_number_;
|
||||
double mean_motion_dt2_{};
|
||||
double mean_motion_ddt6_{};
|
||||
double bstar_{};
|
||||
double inclination_{};
|
||||
double right_ascending_node_{};
|
||||
double eccentricity_{};
|
||||
double argument_perigee_{};
|
||||
double mean_anomaly_{};
|
||||
double mean_motion_{};
|
||||
unsigned int norad_number_{};
|
||||
unsigned int orbit_number_{};
|
||||
|
||||
static const unsigned int TLE_LEN_LINE_DATA = 69;
|
||||
static const unsigned int TLE_LEN_LINE_NAME = 22;
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
* Constructor
|
||||
* @param message Exception message
|
||||
*/
|
||||
TleException(const char* message)
|
||||
explicit TleException(const char* message)
|
||||
: runtime_error(message)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
#include <locale>
|
||||
#include <functional>
|
||||
|
||||
namespace libsgp4
|
||||
{
|
||||
namespace Util
|
||||
namespace libsgp4::Util
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
@ -53,5 +51,4 @@ namespace Util
|
|||
TrimLeft(s);
|
||||
TrimRight(s);
|
||||
}
|
||||
} // namespace Util
|
||||
} // namespace libsgp4
|
||||
} // namespace libsgp4::Util
|
||||
|
|
|
@ -37,10 +37,7 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
Vector()
|
||||
: x(0.0), y(0.0), z(0.0), w(0.0)
|
||||
{
|
||||
}
|
||||
Vector() = default;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -51,7 +48,7 @@ public:
|
|||
Vector(const double arg_x,
|
||||
const double arg_y,
|
||||
const double arg_z)
|
||||
: x(arg_x), y(arg_y), z(arg_z), w(0.0)
|
||||
: x(arg_x), y(arg_y), z(arg_z)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -69,7 +66,7 @@ public:
|
|||
: x(arg_x), y(arg_y), z(arg_z), w(arg_w)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
* @param v value to copy from
|
||||
|
@ -146,13 +143,13 @@ public:
|
|||
}
|
||||
|
||||
/** x value */
|
||||
double x;
|
||||
double x{};
|
||||
/** y value */
|
||||
double y;
|
||||
double y{};
|
||||
/** z value */
|
||||
double z;
|
||||
double z{};
|
||||
/** w value */
|
||||
double w;
|
||||
double w{};
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& strm, const Vector& v)
|
||||
|
|
Loading…
Reference in New Issue