|
| template<typename DataType_ > |
| void | sh::utils::serialize_to_file (DataType_ data, const std::string filepath) |
| | Serializes the given data into the file using cereal lib. More...
|
| |
| template<typename DataType_ > |
| DataType_ | sh::utils::deserialize_from_file (const std::string filepath) |
| | Deserializes the data from the provided file using cereal lib. More...
|
| |
| int64_t | sh::utils::timestamp () |
| | Returns the actual UNIX timestamp (ms). More...
|
| |
| std::string | sh::utils::get_formated_timestamp (const std::string &fmt, UnixTimestamp ts=timestamp()) |
| | Returns string representing current time and date in formated string based on provided format. More...
|
| |
| int | sh::utils::str_to_int (const std::string &str) |
| | Tries to parse the integer from the string. More...
|
| |
| template<typename T_ > |
| T_ | sh::utils::irand (T_ from, T_ to) |
| | Returns a pseudorandom integral number sampled from the uniform distribution [from, to]. More...
|
| |
| template<typename T_ > |
| T_ | sh::utils::frand (T_ from, T_ to) |
| | Returns a pseudorandom floating point number sampled from the uniform distribution [from, to). More...
|
| |
| std::vector< std::string > | sh::utils::split (const std::string &str, char delim) |
| | Splits the string with the provided character delimiter. More...
|
| |
| template<typename T_ > |
| bool | sh::utils::is_set (T_ mask, size_t i) |
| | Tests whether the i-th lowest significant bit is set. More...
|
| |
| template<typename Container_ > |
| void | sh::utils::print_matrix (const Container_ &mat) |
| | Prints out any two-dimensional iterable container. More...
|
| |
| template<typename Container_ > |
| void | sh::utils::print_vector (const Container_ &row) |
| | Prints out any one-dimensional iterable container. More...
|
| |
| std::string | sh::utils::to_lowercase (const std::string &old) |
| | Returns a copy of old string but all lowercase. More...
|
| |
| std::string | sh::utils::sha256_sum (const std::string &filepath) |
| | Computes the SHA256 hash for the given file and returns it. More...
|
| |
| std::string | sh::utils::read_whole_file (const std::string &filepath) |
| | Reads the whole file into string that it will return. More...
|
| |
| std::string | sh::utils::trim_left (const std::string &s) |
| | Left trim. More...
|
| |
| std::string | sh::utils::trim_right (const std::string &s) |
| | Right trim. More...
|
| |
| std::string | sh::utils::trim (const std::string &s) |
| | Trim. More...
|
| |
| template<typename DType_ > |
| void | sh::utils::to_file (const std::vector< DType_ > &vec, const std::string filepath) |
| | Writes the given vector into the given file. More...
|
| |
| template<typename DType_ > |
| void | sh::utils::to_file (const std::vector< std::vector< DType_ >> &mat, const std::string filepath) |
| | Writes the given matrix into the given file. More...
|
| |
| template<typename T_ > |
| T_ | sh::utils::ipow (T_ b, std::size_t p) |
| | Unsigned integer power function. More...
|
| |
| template<typename T_ > |
| T_ | sh::utils::round_decimal (T_ x, std::size_t places) |
| | Rounds the number to the specified number of decimal places. More...
|
| |
| template<class T_ > |
| constexpr std::string_view | sh::utils::type_name () |
| | Returns a string view describing the type T_. More...
|
| |