19#include <source_location>
39 int mapValue(
int x,
int in_min,
int in_max,
int out_min,
int out_max);
48std::ostream&
operator<<(std::ostream& os,
const std::source_location& location);
54template<
typename DATA_T>
63 logData(std::string str, DATA_T
data,
const std::source_location& loc =
64 std::source_location::current())
108 auto now = std::chrono::system_clock::now();
109 auto timeT = std::chrono::system_clock::to_time_t(now);
110 logFile <<
"[" << std::put_time(std::localtime(&timeT),
"%Y-%m-%d %H:%M:%S") <<
"]\n"
114 <<
"-----------------------------\n";
117 perror(
"Error reason");
Exception class template for handling and logging errors.
Definition utility_data_RDL.hpp:55
const DATA_T & data() const noexcept
Retrieves the user-defined data (const version).
Definition utility_data_RDL.hpp:94
const std::source_location errorLocation
Definition utility_data_RDL.hpp:99
DATA_T & data()
Retrieves the user-defined data.
Definition utility_data_RDL.hpp:89
const std::string & what() const noexcept
Retrieves the error message (const version).
Definition utility_data_RDL.hpp:79
DATA_T userData
Definition utility_data_RDL.hpp:98
logData(std::string str, DATA_T data, const std::source_location &loc=std::source_location::current())
Constructs an OmegaException with an error message and user data.
Definition utility_data_RDL.hpp:63
std::string & what()
Retrieves the error message.
Definition utility_data_RDL.hpp:74
void logError() const
Logs the error message to a file. If the logfile cannot be opened, an error message is printed to std...
Definition utility_data_RDL.hpp:104
std::string errorString
Definition utility_data_RDL.hpp:97
const std::source_location & where() const noexcept
Retrieves the source location of the exception.
Definition utility_data_RDL.hpp:84
Name space for config file related utilities.
Definition utility_data_RDL.hpp:29
void loadConfig()
This function loads the config file into program.
Definition utility_data_RDL.cpp:97
bool isDebugEnabled()
retrieve the debug enabled setting , true for debug on
Definition utility_data_RDL.cpp:150
std::string getErrorLogPath()
retrieve the log file path setting
Definition utility_data_RDL.cpp:157
bool isLoggingEnabled()
retrieve the logging enabled setting , true for logging on
Definition utility_data_RDL.cpp:143
Name space for log file related utilities.
Definition utility_data_RDL.hpp:46
std::ostream & operator<<(std::ostream &os, const std::source_location &location)
Overloaded stream insertion operator for std::source_location.
Definition utility_data_RDL.cpp:72
Name space for maths related utilities.
Definition utility_data_RDL.hpp:38
float sineFromDegrees(float angle)
Computes the sine of an angle given in degrees. This function converts the input angle from degrees t...
Definition utility_data_RDL.cpp:55
float cosineFromDegrees(float angle)
Computes the cosine of an angle given in degrees. This function converts the input angle from degrees...
Definition utility_data_RDL.cpp:42
int mapValue(int x, int in_min, int in_max, int out_min, int out_max)
Maps a value from one range to another using linear interpolation. This function takes an input value...
Definition utility_data_RDL.cpp:29