DiFfRG
Loading...
Searching...
No Matches
utils.hh File Reference
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/spdlog.h>
#include <DiFfRG/common/fixed_string.hh>
#include <DiFfRG/common/json.hh>
#include <DiFfRG/common/math.hh>
#include <DiFfRG/common/tuples.hh>

Go to the source code of this file.

Namespaces

namespace  DiFfRG
 

Typedefs

using DiFfRG::uint = unsigned int
 

Functions

template<auto Start, auto End, auto Inc, class F >
constexpr void DiFfRG::constexpr_for (F &&f)
 A compile-time for loop, which calls the lambda f of signature void(integer) for each index.
 
std::shared_ptr< spdlog::logger > DiFfRG::build_logger (const std::string &name, const std::string &filename)
 
std::string DiFfRG::strip_name (const std::string &name)
 Strips all special characters from a string, e.g. for use in filenames.
 
std::vector< double > DiFfRG::string_to_double_array (const std::string &str)
 Takes a string of comma-separated numbers and outputs it as a vector.
 
template<typename T >
std::string DiFfRG::getWithPrecision (uint precision, T number)
 Return number with fixed precision after the decimal point.
 
bool DiFfRG::file_exists (const std::string &name)
 Checks if a file exists.
 
template<typename T >
std::string DiFfRG::to_string_with_digits (const T number, const int digits)
 Return number with fixed significant digits.
 
std::string DiFfRG::make_folder (const std::string &path)
 Add a trailing '/' to a string, in order for it to be in standard form of a folder path.
 
bool DiFfRG::create_folder (const std::string &path_)
 Creates the directory path, even if its parent directories should not exist.
 
std::string DiFfRG::time_format (size_t time_in_seconds)
 Nice output from seconds to h/min/s style string.
 
std::string DiFfRG::time_format_ms (size_t time_in_miliseconds)
 Nice output from seconds to h/min/s style string.
 
bool DiFfRG::has_suffix (const std::string &str, const std::string &suffix)