Cleanup
This commit is contained in:
parent
d9cc4e4aec
commit
5da279a8e6
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,4 +40,5 @@ docs/doxygen/*
|
|||||||
# IDE
|
# IDE
|
||||||
qtrocket.pro.user
|
qtrocket.pro.user
|
||||||
.qmake.stash
|
.qmake.stash
|
||||||
|
CMakeLists.txt.user
|
||||||
|
|
||||||
|
@ -53,6 +53,12 @@ FetchContent_Declare(eigen
|
|||||||
GIT_TAG 3.4.0)
|
GIT_TAG 3.4.0)
|
||||||
FetchContent_MakeAvailable(eigen)
|
FetchContent_MakeAvailable(eigen)
|
||||||
|
|
||||||
|
# boost dependency
|
||||||
|
FetchContent_Declare(Boost
|
||||||
|
GIT_REPOSITORY https://github.com/boostorg/boost
|
||||||
|
GIT_TAG boost-1.82.0)
|
||||||
|
FetchContent_MakeAvailable(Boost)
|
||||||
|
|
||||||
# Add qtrocket subdirectories. These are components that will be linked in
|
# Add qtrocket subdirectories. These are components that will be linked in
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +69,7 @@ set(CMAKE_AUTORCC ON)
|
|||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CMAKE_PREFIX_PATH $ENV{QTDIR})
|
set(CMAKE_PREFIX_PATH $ENV{QTDIR})
|
||||||
include_directories("C:\\boost\\boost_1_82_0\\")
|
# include_directories("C:\\boost\\boost_1_82_0\\")
|
||||||
# find_package(Qt6Core REQUIRED)
|
# find_package(Qt6Core REQUIRED)
|
||||||
# find_package(Qt6Widgets REQUIRED)
|
# find_package(Qt6Widgets REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
17
QtRocket.cpp
17
QtRocket.cpp
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
@ -45,7 +44,7 @@ void guiWorker(int argc, char* argv[], int& ret)
|
|||||||
|
|
||||||
// Go!
|
// Go!
|
||||||
MainWindow w(QtRocket::getInstance());
|
MainWindow w(QtRocket::getInstance());
|
||||||
logger->info("Showing MainWindow");
|
logger->debug("Showing MainWindow");
|
||||||
w.show();
|
w.show();
|
||||||
ret = a.exec();
|
ret = a.exec();
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ void QtRocket::init()
|
|||||||
std::lock_guard<std::mutex> lck(mtx);
|
std::lock_guard<std::mutex> lck(mtx);
|
||||||
if(!initialized)
|
if(!initialized)
|
||||||
{
|
{
|
||||||
utils::Logger::getInstance()->info("Instantiating new QtRocket");
|
utils::Logger::getInstance()->debug("Instantiating new QtRocket");
|
||||||
instance = new QtRocket();
|
instance = new QtRocket();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
@ -88,6 +87,13 @@ QtRocket::QtRocket()
|
|||||||
|
|
||||||
motorDatabase = std::make_shared<utils::MotorModelDatabase>();
|
motorDatabase = std::make_shared<utils::MotorModelDatabase>();
|
||||||
|
|
||||||
|
logger->debug("Initial states vector size: " + states.capacity() );
|
||||||
|
// Reserve at least 1024 spaces for StateData
|
||||||
|
if(states.capacity() < 1024)
|
||||||
|
{
|
||||||
|
states.reserve(1024);
|
||||||
|
}
|
||||||
|
logger->debug("New states vector size: " + states.capacity() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QtRocket::run(int argc, char* argv[])
|
int QtRocket::run(int argc, char* argv[])
|
||||||
@ -122,3 +128,8 @@ void QtRocket::addMotorModels(std::vector<model::MotorModel>& m)
|
|||||||
motorDatabase->addMotorModels(m);
|
motorDatabase->addMotorModels(m);
|
||||||
// TODO: Now clear any duplicates?
|
// TODO: Now clear any duplicates?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtRocket::appendState(const StateData& state)
|
||||||
|
{
|
||||||
|
states.emplace_back(state);
|
||||||
|
}
|
||||||
|
14
QtRocket.h
14
QtRocket.h
@ -15,12 +15,11 @@
|
|||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "model/MotorModel.h"
|
#include "model/MotorModel.h"
|
||||||
#include "model/Rocket.h"
|
#include "model/Rocket.h"
|
||||||
#include "sim/AtmosphericModel.h"
|
|
||||||
#include "sim/GravityModel.h"
|
|
||||||
#include "sim/Environment.h"
|
#include "sim/Environment.h"
|
||||||
#include "sim/Propagator.h"
|
#include "sim/Propagator.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/MotorModelDatabase.h"
|
#include "utils/MotorModelDatabase.h"
|
||||||
|
#include "utils/math/MathTypes.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QtRocket class is the master controller for the QtRocket application.
|
* @brief The QtRocket class is the master controller for the QtRocket application.
|
||||||
@ -67,6 +66,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setInitialState(const StateData& initState) { rocket.second->setInitialState(initState); }
|
void setInitialState(const StateData& initState) { rocket.second->setInitialState(initState); }
|
||||||
|
|
||||||
|
void appendState(const StateData& state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtRocket();
|
QtRocket();
|
||||||
|
|
||||||
@ -84,6 +85,15 @@ private:
|
|||||||
std::shared_ptr<sim::Environment> environment;
|
std::shared_ptr<sim::Environment> environment;
|
||||||
std::shared_ptr<utils::MotorModelDatabase> motorDatabase;
|
std::shared_ptr<utils::MotorModelDatabase> motorDatabase;
|
||||||
|
|
||||||
|
// Launch site
|
||||||
|
// ECEF coordinates
|
||||||
|
Vector3 launchSitePosition{0.0, 0.0, 0.0};
|
||||||
|
|
||||||
|
// Table of state data
|
||||||
|
std::vector<StateData> states;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QTROCKET_H
|
#endif // QTROCKET_H
|
||||||
|
9
main.cpp
9
main.cpp
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
|
|
||||||
#include "QtRocket.h"
|
#include "QtRocket.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
@ -14,13 +12,16 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Instantiate logger
|
// Instantiate logger
|
||||||
utils::Logger* logger = utils::Logger::getInstance();
|
utils::Logger* logger = utils::Logger::getInstance();
|
||||||
logger->setLogLevel(utils::Logger::DEBUG_);
|
logger->setLogLevel(utils::Logger::PERF_);
|
||||||
|
logger->info("Logger instantiated at PERF level");
|
||||||
// instantiate QtRocket
|
// instantiate QtRocket
|
||||||
|
logger->debug("Starting QtRocket");
|
||||||
QtRocket* qtrocket = QtRocket::getInstance();
|
QtRocket* qtrocket = QtRocket::getInstance();
|
||||||
|
|
||||||
// Run QtRocket. This'll start the GUI thread and block until the user
|
// Run QtRocket. This'll start the GUI thread and block until the user
|
||||||
// exits the program
|
// exits the program
|
||||||
|
logger->debug("QtRocket->run()");
|
||||||
int retVal = qtrocket->run(argc, argv);
|
int retVal = qtrocket->run(argc, argv);
|
||||||
logger->debug("Returning");
|
logger->debug("Returning");
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <utility>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
@ -13,7 +12,6 @@
|
|||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "utils/math/MathTypes.h"
|
#include "utils/math/MathTypes.h"
|
||||||
#include "model/Part.h"
|
|
||||||
|
|
||||||
namespace model
|
namespace model
|
||||||
{
|
{
|
||||||
@ -120,4 +118,4 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MODEL_PART_H
|
#endif // MODEL_PART_H
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "Rocket.h"
|
#include "Rocket.h"
|
||||||
#include "QtRocket.h"
|
|
||||||
|
|
||||||
namespace model
|
namespace model
|
||||||
{
|
{
|
||||||
@ -45,4 +44,4 @@ double Rocket::getMass(double t)
|
|||||||
return totalMass;
|
return totalMass;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace model
|
} // namespace model
|
||||||
|
@ -13,9 +13,7 @@
|
|||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "model/ThrustCurve.h"
|
|
||||||
#include "sim/Propagator.h"
|
#include "sim/Propagator.h"
|
||||||
#include "utils/math/MathTypes.h"
|
|
||||||
|
|
||||||
#include "model/Stage.h"
|
#include "model/Stage.h"
|
||||||
#include "model/Propagatable.h"
|
#include "model/Propagatable.h"
|
||||||
@ -52,7 +50,7 @@ public:
|
|||||||
* @param t current simulation time
|
* @param t current simulation time
|
||||||
* @return thrust in Newtons
|
* @return thrust in Newtons
|
||||||
*/
|
*/
|
||||||
double getThrust(double t);
|
double getThrust(double t) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getMass returns current rocket
|
* @brief getMass returns current rocket
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
@ -24,4 +22,4 @@ void Stage::setMotorModel(const model::MotorModel& motor)
|
|||||||
mm = motor;
|
mm = motor;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace model
|
} // namespace model
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
#include "model/ThrustCurve.h"
|
#include "model/ThrustCurve.h"
|
||||||
#include "utils/Logger.h"
|
|
||||||
|
|
||||||
|
|
||||||
ThrustCurve::ThrustCurve(std::vector<std::pair<double, double>>& tc)
|
ThrustCurve::ThrustCurve(std::vector<std::pair<double, double>>& tc)
|
||||||
: thrustCurve(tc),
|
: thrustCurve(tc),
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <string>
|
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
@ -38,4 +37,4 @@ private:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SIM_AERO_H
|
#endif // SIM_AERO_H
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "AtmosphericModel.h"
|
#include "AtmosphericModel.h"
|
||||||
#include "utils/math/Constants.h"
|
|
||||||
|
|
||||||
namespace sim {
|
namespace sim {
|
||||||
|
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <vector>
|
#include <utility>
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "utils/math/MathTypes.h"
|
|
||||||
|
|
||||||
namespace sim
|
namespace sim
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#include "sim/ConstantAtmosphere.h"
|
#include "sim/ConstantAtmosphere.h"
|
||||||
#include "sim/USStandardAtmosphere.h"
|
#include "sim/USStandardAtmosphere.h"
|
||||||
#include "sim/GeoidModel.h"
|
|
||||||
|
|
||||||
namespace sim
|
namespace sim
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <cmath>
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
// C++ headers
|
// C++ headers
|
||||||
#include <cmath>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// 3rd party headers
|
// 3rd party headers
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ namespace sim
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Populate static data
|
// Populate static data
|
||||||
utils::BinMap initTemps()
|
utils::Bin initTemps()
|
||||||
{
|
{
|
||||||
utils::BinMap map;
|
utils::Bin map;
|
||||||
map.insert(std::make_pair(0.0, 288.15));
|
map.insert(std::make_pair(0.0, 288.15));
|
||||||
map.insert(std::make_pair(11000.0, 216.65));
|
map.insert(std::make_pair(11000.0, 216.65));
|
||||||
map.insert(std::make_pair(20000.0, 216.65));
|
map.insert(std::make_pair(20000.0, 216.65));
|
||||||
@ -33,9 +33,9 @@ utils::BinMap initTemps()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::BinMap initLapseRates()
|
utils::Bin initLapseRates()
|
||||||
{
|
{
|
||||||
utils::BinMap map;
|
utils::Bin map;
|
||||||
map.insert(std::make_pair(0.0, 0.0065));
|
map.insert(std::make_pair(0.0, 0.0065));
|
||||||
map.insert(std::make_pair(11000.0, 0.0));
|
map.insert(std::make_pair(11000.0, 0.0));
|
||||||
map.insert(std::make_pair(20000.0, -0.001));
|
map.insert(std::make_pair(20000.0, -0.001));
|
||||||
@ -47,9 +47,9 @@ utils::BinMap initLapseRates()
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::BinMap initDensities()
|
utils::Bin initDensities()
|
||||||
{
|
{
|
||||||
utils::BinMap map;
|
utils::Bin map;
|
||||||
map.insert(std::make_pair(0.0, 1.225));
|
map.insert(std::make_pair(0.0, 1.225));
|
||||||
map.insert(std::make_pair(11000.0, 0.36391));
|
map.insert(std::make_pair(11000.0, 0.36391));
|
||||||
map.insert(std::make_pair(20000.0, 0.08803));
|
map.insert(std::make_pair(20000.0, 0.08803));
|
||||||
@ -61,9 +61,9 @@ utils::BinMap initDensities()
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::BinMap initPressures()
|
utils::Bin initPressures()
|
||||||
{
|
{
|
||||||
utils::BinMap map;
|
utils::Bin map;
|
||||||
map.insert(std::make_pair(0.0, 101325));
|
map.insert(std::make_pair(0.0, 101325));
|
||||||
map.insert(std::make_pair(11000.0, 22632.1));
|
map.insert(std::make_pair(11000.0, 22632.1));
|
||||||
map.insert(std::make_pair(20000.0, 5474.89));
|
map.insert(std::make_pair(20000.0, 5474.89));
|
||||||
@ -75,10 +75,10 @@ utils::BinMap initPressures()
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
utils::BinMap USStandardAtmosphere::temperatureLapseRate(initLapseRates());
|
utils::Bin USStandardAtmosphere::temperatureLapseRate(initLapseRates());
|
||||||
utils::BinMap USStandardAtmosphere::standardTemperature(initTemps());
|
utils::Bin USStandardAtmosphere::standardTemperature(initTemps());
|
||||||
utils::BinMap USStandardAtmosphere::standardDensity(initDensities());
|
utils::Bin USStandardAtmosphere::standardDensity(initDensities());
|
||||||
utils::BinMap USStandardAtmosphere::standardPressure(initPressures());
|
utils::Bin USStandardAtmosphere::standardPressure(initPressures());
|
||||||
|
|
||||||
USStandardAtmosphere::USStandardAtmosphere()
|
USStandardAtmosphere::USStandardAtmosphere()
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "sim/AtmosphericModel.h"
|
#include "sim/AtmosphericModel.h"
|
||||||
#include "utils/BinMap.h"
|
#include "utils/Bin.h"
|
||||||
|
|
||||||
namespace sim
|
namespace sim
|
||||||
{
|
{
|
||||||
@ -33,10 +33,10 @@ public:
|
|||||||
double getDynamicViscosity(double altitude) override;
|
double getDynamicViscosity(double altitude) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static utils::BinMap temperatureLapseRate;
|
static utils::Bin temperatureLapseRate;
|
||||||
static utils::BinMap standardTemperature;
|
static utils::Bin standardTemperature;
|
||||||
static utils::BinMap standardDensity;
|
static utils::Bin standardDensity;
|
||||||
static utils::BinMap standardPressure;
|
static utils::Bin standardPressure;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/// \endcond
|
/// \endcond
|
||||||
|
|
||||||
// qtrocket headers
|
// qtrocket headers
|
||||||
#include "BinMap.h"
|
#include "Bin.h"
|
||||||
|
|
||||||
// TODO: Check on the availability of this in Clang.
|
// TODO: Check on the availability of this in Clang.
|
||||||
// Replace libfmt with format when LLVM libc++ supports it
|
// Replace libfmt with format when LLVM libc++ supports it
|
||||||
@ -20,33 +20,33 @@
|
|||||||
namespace utils
|
namespace utils
|
||||||
{
|
{
|
||||||
|
|
||||||
BinMap::BinMap()
|
Bin::Bin()
|
||||||
: bins()
|
: bins()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BinMap::BinMap(BinMap&& o)
|
Bin::Bin(Bin&& o)
|
||||||
: bins(std::move(o.bins))
|
: bins(std::move(o.bins))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BinMap::~BinMap()
|
Bin::~Bin()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Very low priority, but if anyone wants to make this more efficient it could be
|
// TODO: Very low priority, but if anyone wants to make this more efficient it could be
|
||||||
// interesting
|
// interesting
|
||||||
void BinMap::insert(const std::pair<double, double>& toInsert)
|
void Bin::insert(const std::pair<double, double>& toInsert)
|
||||||
{
|
{
|
||||||
bins.push_back(toInsert);
|
bins.push_back(toInsert);
|
||||||
std::sort(bins.begin(), bins.end(),
|
std::sort(bins.begin(), bins.end(),
|
||||||
[](const auto& a, const auto& b){ return a.first < b.first; });
|
[](const auto& a, const auto& b){ return a.first < b.first; });
|
||||||
}
|
}
|
||||||
|
|
||||||
double BinMap::operator[](double key)
|
double Bin::operator[](double key)
|
||||||
{
|
{
|
||||||
auto iter = bins.begin();
|
auto iter = bins.begin();
|
||||||
// If the key is less than the lowest bin value, then it is out of range
|
// If the key is less than the lowest bin value, then it is out of range
|
||||||
@ -74,7 +74,7 @@ double BinMap::operator[](double key)
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
double BinMap::getBinBase(double key)
|
double Bin::getBinBase(double key)
|
||||||
{
|
{
|
||||||
auto iter = bins.begin();
|
auto iter = bins.begin();
|
||||||
// If the key is less than the lowest bin value, then it is out of range
|
// If the key is less than the lowest bin value, then it is out of range
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef UTILS_BINMAP_H
|
#ifndef UTILS_BIN_H
|
||||||
#define UTILS_BINMAP_H
|
#define UTILS_BIN_H
|
||||||
|
|
||||||
/// \cond
|
/// \cond
|
||||||
// C headers
|
// C headers
|
||||||
@ -22,12 +22,12 @@ namespace utils {
|
|||||||
* @todo Make this class behave more like a proper STL container. Templetize it for one
|
* @todo Make this class behave more like a proper STL container. Templetize it for one
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class BinMap
|
class Bin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BinMap();
|
Bin();
|
||||||
BinMap(BinMap&& o);
|
Bin(Bin&& o);
|
||||||
~BinMap();
|
~Bin();
|
||||||
|
|
||||||
void insert(const std::pair<double, double>& toInsert);
|
void insert(const std::pair<double, double>& toInsert);
|
||||||
double operator[](double key);
|
double operator[](double key);
|
||||||
@ -40,4 +40,4 @@ private:
|
|||||||
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
#endif // UTILS_BINMAP_H
|
#endif // UTILS_BIN_H
|
@ -1,6 +1,6 @@
|
|||||||
add_library(utils
|
add_library(utils
|
||||||
BinMap.cpp
|
Bin.cpp
|
||||||
BinMap.h
|
Bin.h
|
||||||
CurlConnection.cpp
|
CurlConnection.cpp
|
||||||
CurlConnection.h
|
CurlConnection.h
|
||||||
Logger.cpp
|
Logger.cpp
|
||||||
@ -18,6 +18,10 @@ add_library(utils
|
|||||||
math/MathTypes.h
|
math/MathTypes.h
|
||||||
math/UtilityMathFunctions.h)
|
math/UtilityMathFunctions.h)
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(utils PRIVATE
|
||||||
|
${Boost_INCLUDE_DIR})
|
||||||
|
|
||||||
target_link_libraries(utils PUBLIC
|
target_link_libraries(utils PUBLIC
|
||||||
libcurl
|
libcurl
|
||||||
jsoncpp_static
|
jsoncpp_static
|
||||||
|
@ -40,6 +40,13 @@ void Logger::log(std::string_view msg, const LogLevel& lvl)
|
|||||||
// all levels at or lower than the current level.
|
// all levels at or lower than the current level.
|
||||||
switch(currentLevel)
|
switch(currentLevel)
|
||||||
{
|
{
|
||||||
|
case PERF_:
|
||||||
|
if(lvl == PERF_)
|
||||||
|
{
|
||||||
|
outFile << "[PERF] " << msg << std::endl;
|
||||||
|
std::cout << "[PERF] " << msg << "\n";
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case DEBUG_:
|
case DEBUG_:
|
||||||
if(lvl == DEBUG_)
|
if(lvl == DEBUG_)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,8 @@ public:
|
|||||||
ERROR_,
|
ERROR_,
|
||||||
WARN_,
|
WARN_,
|
||||||
INFO_,
|
INFO_,
|
||||||
DEBUG_
|
DEBUG_,
|
||||||
|
PERF_
|
||||||
};
|
};
|
||||||
|
|
||||||
static Logger* getInstance();
|
static Logger* getInstance();
|
||||||
@ -38,16 +39,11 @@ public:
|
|||||||
|
|
||||||
void setLogLevel(const LogLevel& lvl);
|
void setLogLevel(const LogLevel& lvl);
|
||||||
|
|
||||||
/*
|
|
||||||
std::function<void(std::string_view)> error;
|
|
||||||
std::function<void(std::string_view)> warn;
|
|
||||||
std::function<void(std::string_view)> info;
|
|
||||||
std::function<void(std::string_view)> debug;
|
|
||||||
*/
|
|
||||||
inline void error(std::string_view msg) { log(msg, ERROR_); }
|
inline void error(std::string_view msg) { log(msg, ERROR_); }
|
||||||
inline void warn(std::string_view msg) { log(msg, WARN_); }
|
inline void warn(std::string_view msg) { log(msg, WARN_); }
|
||||||
inline void info(std::string_view msg) { log(msg, INFO_); }
|
inline void info(std::string_view msg) { log(msg, INFO_); }
|
||||||
inline void debug(std::string_view msg) { log(msg, DEBUG_); }
|
inline void debug(std::string_view msg) { log(msg, DEBUG_); }
|
||||||
|
inline void perf(std::string_view msg) { log(msg, PERF_); }
|
||||||
|
|
||||||
void log(std::ostream& o, const std::string& msg);
|
void log(std::ostream& o, const std::string& msg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user